| 104 |
|
|
| 105 |
int press_any_key() |
int press_any_key() |
| 106 |
{ |
{ |
| 107 |
|
int ch = 0; |
| 108 |
|
int wait_seconds = 60; |
| 109 |
|
int duration = 0; |
| 110 |
|
time_t t_begin = time(NULL); |
| 111 |
|
|
| 112 |
moveto(SCREEN_ROWS, 0); |
moveto(SCREEN_ROWS, 0); |
| 113 |
clrtoeol(); |
clrtoeol(); |
| 114 |
|
|
| 115 |
prints(" \033[1;33m按任意键继续...\033[0;37m"); |
prints(" \033[1;33m按任意键继续...\033[0;37m"); |
| 116 |
iflush(); |
iflush(); |
| 117 |
|
|
| 118 |
return igetch_t(MIN(MAX_DELAY_TIME, 60)); |
do |
| 119 |
|
{ |
| 120 |
|
ch = igetch_t(wait_seconds - duration); |
| 121 |
|
duration = (int)(time(NULL) - t_begin); |
| 122 |
|
} while (!SYS_server_exit && ch == 0 && duration < 60); |
| 123 |
|
|
| 124 |
|
return ch; |
| 125 |
} |
} |
| 126 |
|
|
| 127 |
void set_input_echo(int echo) |
void set_input_echo(int echo) |
| 129 |
if (echo) |
if (echo) |
| 130 |
{ |
{ |
| 131 |
outc('\x83'); // ASCII code 131 |
outc('\x83'); // ASCII code 131 |
|
iflush(); |
|
| 132 |
} |
} |
| 133 |
else |
else |
| 134 |
{ |
{ |
| 135 |
// outc ('\x85'); // ASCII code 133 |
// outc ('\x85'); // ASCII code 133 |
| 136 |
prints("\xff\xfb\x01\xff\xfb\x03"); |
prints("\xff\xfb\x01\xff\xfb\x03"); |
|
iflush(); |
|
|
igetch(0); |
|
|
igetch_reset(); |
|
| 137 |
} |
} |
| 138 |
|
iflush(); |
| 139 |
} |
} |
| 140 |
|
|
| 141 |
static int _str_input(char *buffer, int buf_size, int max_display_len, int echo_mode) |
static int _str_input(char *buffer, int buf_size, int max_display_len, int echo_mode) |
| 159 |
|
|
| 160 |
if (ch == CR) |
if (ch == CR) |
| 161 |
{ |
{ |
|
igetch_reset(); |
|
| 162 |
break; |
break; |
| 163 |
} |
} |
| 164 |
else if (ch == KEY_TIMEOUT || ch == KEY_NULL) // timeout or broken pipe |
else if (ch == KEY_TIMEOUT || ch == KEY_NULL) // timeout or broken pipe |
| 329 |
|
|
| 330 |
if (ch == CR) |
if (ch == CR) |
| 331 |
{ |
{ |
|
igetch_reset(); |
|
| 332 |
break; |
break; |
| 333 |
} |
} |
| 334 |
else if (ch == KEY_TIMEOUT || ch == KEY_NULL) // timeout or broken pipe |
else if (ch == KEY_TIMEOUT || ch == KEY_NULL) // timeout or broken pipe |
| 710 |
output_end_row = SCREEN_ROWS - 1; // Legacy Fterm only works with this line |
output_end_row = SCREEN_ROWS - 1; // Legacy Fterm only works with this line |
| 711 |
break; |
break; |
| 712 |
case CR: |
case CR: |
|
igetch_reset(); |
|
| 713 |
case KEY_SPACE: |
case KEY_SPACE: |
| 714 |
case KEY_DOWN: |
case KEY_DOWN: |
| 715 |
if (line_current + (screen_row_total - (output_current_row - screen_begin_row)) >= display_line_total) // Reach end |
if (line_current + (screen_row_total - (output_current_row - screen_begin_row)) >= display_line_total) // Reach end |