32 #ifndef LIBITE_CONIO_H_ 33 #define LIBITE_CONIO_H_ 58 #define LIGHTGREEN 0x12 60 #define LIGHTBLUE 0x14 61 #define LIGHTMAGENTA 0x15 62 #define LIGHTCYAN 0x16 66 #define SCREEN_WIDTH 80 70 #define clrscr() fputs("\033[2J\033[1;1H", stdout) 72 #define clreol() fputs("\033[K", stdout) 74 #define delline() fputs("\033[2K", stdout) 76 #define gotoxy(x,y) fprintf(stdout, "\033[%d;%dH", y, x) 78 #define hidecursor() fputs("\033[?25l", stdout) 80 #define showcursor() fputs("\033[?25h", stdout) 83 #define __set_gm(a,c,v) \ 85 fprintf(stdout, "\033[%dm", a); \ 87 fprintf(stdout, "\033[%d;%dm", c & 0x10 ? 1 : 0, (c & 0xF) + v) 90 #define textattr(attr) __set_gm(attr, 0, 0) 92 #define textcolor(color) __set_gm(RESETATTR, color, 30) 94 #define textbackground(color) __set_gm(RESETATTR, color, 40) 96 void initscr(
int *row,
int *col);
111 static inline void printhdr(FILE *fp,
const char *line,
int nl,
int attr)
113 if (attr < 0 || attr > 8)
116 fprintf(fp ?: stdout,
117 "%s\033[%dm%s%*s\033[0m\n",
118 nl ?
"\n" :
"", attr, line,
128 static inline void printheader(FILE *fp,
const char *line,
int nl)
130 printhdr(fp, line, nl, REVERSE);
#define SCREEN_WIDTH
Fallback screen width, possible to override.
Definition: conio.h:66
void initscr(int *row, int *col)
Probe terminal size.
Definition: conio.c:44