| 3 |
* screen |
* screen |
| 4 |
* - advanced telnet-based user interactive input / output features |
* - advanced telnet-based user interactive input / output features |
| 5 |
* |
* |
| 6 |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
* Copyright (C) 2004-2026 Leaflet <leaflet@leafok.com> |
| 7 |
*/ |
*/ |
| 8 |
|
|
| 9 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
| 98 |
|
|
| 99 |
int press_any_key_ex(const char *msg, int sec) |
int press_any_key_ex(const char *msg, int sec) |
| 100 |
{ |
{ |
|
int ch = 0; |
|
|
int duration = 0; |
|
|
time_t t_begin = time(NULL); |
|
|
|
|
| 101 |
moveto(SCREEN_ROWS, 0); |
moveto(SCREEN_ROWS, 0); |
| 102 |
clrtoeol(); |
clrtoeol(); |
| 103 |
|
|
| 104 |
prints(msg); |
prints(msg); |
| 105 |
iflush(); |
iflush(); |
| 106 |
|
|
| 107 |
|
return press_any_key_no_prompt(sec); |
| 108 |
|
} |
| 109 |
|
|
| 110 |
|
inline int press_any_key_no_prompt(int sec) |
| 111 |
|
{ |
| 112 |
|
int ch = 0; |
| 113 |
|
int duration = 0; |
| 114 |
|
time_t t_begin = time(NULL); |
| 115 |
|
|
| 116 |
igetch_reset(); |
igetch_reset(); |
| 117 |
|
|
| 118 |
do |
do |
| 170 |
{ |
{ |
| 171 |
continue; |
continue; |
| 172 |
} |
} |
| 173 |
|
else if (ch == KEY_ESC) |
| 174 |
|
{ |
| 175 |
|
buffer[0] = '\0'; |
| 176 |
|
offset = 0; |
| 177 |
|
break; |
| 178 |
|
} |
| 179 |
else if (ch == BACKSPACE || ch == KEY_DEL) |
else if (ch == BACKSPACE || ch == KEY_DEL) |
| 180 |
{ |
{ |
| 181 |
if (offset > 0) |
if (offset > 0) |
| 351 |
{ |
{ |
| 352 |
continue; |
continue; |
| 353 |
} |
} |
| 354 |
|
else if (ch == KEY_ESC) |
| 355 |
|
{ |
| 356 |
|
buffer[0] = '\0'; |
| 357 |
|
len = 0; |
| 358 |
|
break; |
| 359 |
|
} |
| 360 |
else if (ch == BACKSPACE) |
else if (ch == BACKSPACE) |
| 361 |
{ |
{ |
| 362 |
if (offset > 0) |
if (offset > 0) |