62static const char* __prefix =
"\033[";
80static const int __getch(uint8_t __echo) {
81 struct termios __oldt, __newt;
84 tcgetattr(STDIN_FILENO, &__oldt);
86 __newt.c_lflag &= ~ICANON;
89 __newt.c_lflag &= ECHO;
91 __newt.c_lflag &= ~ECHO;
94 tcsetattr(STDIN_FILENO, TCSANOW, &__newt);
96 tcsetattr(STDIN_FILENO, TCSANOW, &__oldt);
116 printf(
"%s6n", __prefix);
121 if (__getch(0) !=
'\x1B') {
123 }
else if (__getch(0) !=
'\x5B') {
127 while ((in = __getch(0)) !=
';') {
128 y = y * 10 + in -
'0';
131 while ((in = __getch(0)) !=
'R') {
132 x = x * 10 + in -
'0';
154 printf(
"%s%u;%uf", __prefix, __y, __x);
181 printf(
"%s0m%s1J%sH", __prefix, __prefix, __prefix);
211 printf(
"%s0m\033c", __prefix);
229 return ungetc(__c, stdin);
276 __whereis_xy(&__x, &__y);
295 __whereis_xy(&__x, &__y);
315 __whereis_xy(__x, __y);
void wherexy(cpos_t *__x, cpos_t *__y)
Retrieves the current X and Y coordinates of the cursor on the terminal screen.
Definition conio_lt.h:314
void clrscr(void)
Clears the terminal screen.
Definition conio_lt.h:180
const cpos_t wherey(void)
Retrieves the current Y-coordinate of the cursor on the terminal screen.
Definition conio_lt.h:293
void rstscr(void)
Resets and clears the terminal screen.
Definition conio_lt.h:210
const cpos_t wherex(void)
Retrieves the current X-coordinate of the cursor on the terminal screen.
Definition conio_lt.h:274
unsigned int cpos_t
An abbreviation from Cursor Position Type.
Definition conio_lt.h:58
const int putch(const int __chr)
Writes a character to the standard output.
Definition conio_lt.h:330
const int getch(void)
Reads a single character from the standard input without echoing it.
Definition conio_lt.h:243
void gotox(const cpos_t __x)
Sets the cursor position to the specified X-coordinate, maintaining the current Y-coordinate.
Definition conio_lt.h:349
void gotoy(const cpos_t __y)
Sets the cursor position to the specified Y-coordinate, maintaining the current X-coordinate.
Definition conio_lt.h:367
const int getche(void)
Reads a single character from the standard input and then echoing it.
Definition conio_lt.h:258
const int ungetch(const int __c)
Pushes a character back onto the input stream.
Definition conio_lt.h:228
void gotoxy(const cpos_t __x, const cpos_t __y)
Moves the cursor to the specified coordinates on the terminal screen.
Definition conio_lt.h:153