mirror of
https://github.com/troglobit/libite.git
synced 2026-11-29 20:58:25 +00:00
conio.h: Add top-like heading macro, printheader()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
f89c3c88de
commit
2a59289d53
1 file changed
+8
@@ -48,6 +48,10 @@
|
|||||||
#define LIGHTCYAN 0x16
|
#define LIGHTCYAN 0x16
|
||||||
#define WHITE 0x17
|
#define WHITE 0x17
|
||||||
|
|
||||||
|
#ifndef SCREEN_WIDTH
|
||||||
|
#define SCREEN_WIDTH 80 /* Override as #define SCREEN_WIDTH tty_width() */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Esc[2JEsc[1;1H - Clear screen and move cursor to 1,1 (upper left) pos. */
|
/* Esc[2JEsc[1;1H - Clear screen and move cursor to 1,1 (upper left) pos. */
|
||||||
#define clrscr() fputs ("\033[2J\033[1;1H", stdout)
|
#define clrscr() fputs ("\033[2J\033[1;1H", stdout)
|
||||||
/* Esc[K - Erases from the current cursor position to the end of the current line. */
|
/* Esc[K - Erases from the current cursor position to the end of the current line. */
|
||||||
@@ -71,6 +75,10 @@
|
|||||||
#define textcolor(color) __set_gm(RESETATTR, color, 30)
|
#define textcolor(color) __set_gm(RESETATTR, color, 30)
|
||||||
#define textbackground(color) __set_gm(RESETATTR, color, 40)
|
#define textbackground(color) __set_gm(RESETATTR, color, 40)
|
||||||
|
|
||||||
|
#define printheader(fp, line, nl) \
|
||||||
|
fprintf(fp ?: stdout, "%s\033[7m%s%*s\033[0m\n", nl ? "\n" : "",\
|
||||||
|
line, SCREEN_WIDTH - (int)strlen(line), "")
|
||||||
|
|
||||||
#endif /* CONIO_H_ */
|
#endif /* CONIO_H_ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user