| 151 |
{ |
{ |
| 152 |
if (!hz && offset + 2 > buffer_length) // No enough space for Chinese character |
if (!hz && offset + 2 > buffer_length) // No enough space for Chinese character |
| 153 |
{ |
{ |
| 154 |
igetch(1); // Clear remaining input |
igetch(1); // Cleanup remaining input |
| 155 |
outc('\a'); |
outc('\a'); |
| 156 |
iflush(); |
iflush(); |
| 157 |
continue; |
continue; |
| 181 |
} |
} |
| 182 |
} |
} |
| 183 |
|
|
|
prints("\r\n"); |
|
|
iflush(); |
|
|
|
|
| 184 |
return offset; |
return offset; |
| 185 |
} |
} |
| 186 |
|
|
| 187 |
int str_input(char *buffer, int buffer_length, int echo_mode) |
int str_input(char *buffer, int buffer_length, int echo_mode) |
| 188 |
{ |
{ |
| 189 |
int offset; |
int len; |
| 190 |
|
|
| 191 |
|
buffer[0] = '\0'; |
| 192 |
|
|
| 193 |
memset(buffer, '\0', buffer_length); |
len = _str_input(buffer, buffer_length, echo_mode); |
| 194 |
|
|
| 195 |
offset = _str_input(buffer, buffer_length, echo_mode); |
prints("\r\n"); |
| 196 |
|
iflush(); |
| 197 |
|
|
| 198 |
return offset; |
return len; |
| 199 |
}; |
}; |
| 200 |
|
|
| 201 |
int get_data(int row, int col, char *prompt, char *buffer, int buffer_length, int echo_mode) |
int get_data(int row, int col, char *prompt, char *buffer, int buffer_length, int echo_mode) |
| 420 |
{ |
{ |
| 421 |
char buffer[LINE_BUFFER_LEN]; |
char buffer[LINE_BUFFER_LEN]; |
| 422 |
|
|
| 423 |
str_space(buffer, 20 - strlen(BBS_current_section_name)); |
str_space(buffer, 20 - strnlen(BBS_current_section_name, sizeof(BBS_current_section_name))); |
| 424 |
|
|
| 425 |
moveto(1, 0); |
moveto(1, 0); |
| 426 |
clrtoeol(); |
clrtoeol(); |
| 440 |
struct tm *tm_online; |
struct tm *tm_online; |
| 441 |
|
|
| 442 |
get_time_str(str_time, sizeof(str_time)); |
get_time_str(str_time, sizeof(str_time)); |
| 443 |
str_space(buffer, 33 - strlen(BBS_username)); |
str_space(buffer, 33 - strnlen(BBS_username, sizeof(BBS_username))); |
| 444 |
|
|
| 445 |
time_online = time(0) - BBS_login_tm; |
time_online = time(0) - BBS_login_tm; |
| 446 |
tm_online = gmtime(&time_online); |
tm_online = gmtime(&time_online); |