| 298 |
input_ok = 1; |
input_ok = 1; |
| 299 |
switch (ch) |
switch (ch) |
| 300 |
{ |
{ |
| 301 |
case KEY_NULL: |
// case KEY_NULL: |
| 302 |
case KEY_TIMEOUT: |
case KEY_TIMEOUT: |
| 303 |
goto cleanup; |
goto cleanup; |
| 304 |
case KEY_HOME: |
case KEY_HOME: |
| 395 |
clrline(begin_line, SCREEN_ROWS); |
clrline(begin_line, SCREEN_ROWS); |
| 396 |
break; |
break; |
| 397 |
default: |
default: |
|
log_std("Input: %d\n", ch); |
|
| 398 |
input_ok = 0; |
input_ok = 0; |
| 399 |
break; |
break; |
| 400 |
} |
} |
| 431 |
return ch; |
return ch; |
| 432 |
} |
} |
| 433 |
|
|
| 434 |
int show_top(char *status) |
int show_top(const char *status) |
| 435 |
{ |
{ |
| 436 |
|
char status_f[21]; |
| 437 |
int truncate; |
int truncate; |
| 438 |
int status_len; |
int status_len; |
| 439 |
int section_name_len; |
int section_name_len; |
| 440 |
int len; |
int len; |
| 441 |
|
|
| 442 |
len = split_line(status, 20, &truncate, &status_len); |
strncpy(status_f, status, sizeof(status_f) - 1); |
| 443 |
|
status_f[sizeof(status_f) - 1] = '\0'; |
| 444 |
|
|
| 445 |
|
len = split_line(status_f, 20, &truncate, &status_len); |
| 446 |
if (truncate) |
if (truncate) |
| 447 |
{ |
{ |
| 448 |
status[len] = '\0'; |
log_error("Status string is truncated\n"); |
| 449 |
|
status_f[len] = '\0'; |
| 450 |
} |
} |
| 451 |
|
|
| 452 |
len = split_line(BBS_current_section_name, 20, &truncate, §ion_name_len); |
len = split_line(BBS_current_section_name, 20, &truncate, §ion_name_len); |
| 453 |
if (truncate) |
if (truncate) |
| 454 |
{ |
{ |
| 455 |
status[len] = '\0'; |
log_error("Section name is truncated\n"); |
| 456 |
} |
} |
| 457 |
|
|
| 458 |
moveto(1, 0); |
moveto(1, 0); |
| 459 |
clrtoeol(); |
clrtoeol(); |
| 460 |
prints("\033[1;44;33m%s \033[37m%*s%*s\033[33m ÌÖÂÛÇø [%s]\033[m", |
prints("\033[1;44;33m%s\033[37m%*s%*s\033[33m ÌÖÂÛÇø [%s]\033[m", |
| 461 |
status, (39 - status_len), BBS_name, (30 - section_name_len), "", BBS_current_section_name); |
status_f, 32, BBS_name, 26, "", BBS_current_section_name); |
| 462 |
iflush(); |
iflush(); |
| 463 |
|
|
| 464 |
return 0; |
return 0; |
| 465 |
} |
} |
| 466 |
|
|
| 467 |
int show_bottom(char *msg) |
int show_bottom(const char *msg) |
| 468 |
{ |
{ |
| 469 |
char str_time[LINE_BUFFER_LEN]; |
char str_time[LINE_BUFFER_LEN]; |
|
char space[LINE_BUFFER_LEN]; |
|
| 470 |
time_t time_online; |
time_t time_online; |
| 471 |
struct tm *tm_online; |
struct tm *tm_online; |
| 472 |
|
char msg_f[21]; |
| 473 |
|
int truncate; |
| 474 |
|
int msg_len; |
| 475 |
|
int len; |
| 476 |
|
int len_username; |
| 477 |
|
|
| 478 |
get_time_str(str_time, sizeof(str_time)); |
get_time_str(str_time, sizeof(str_time)); |
| 479 |
str_space(space, 34 - (int)strnlen(BBS_username, sizeof(BBS_username))); |
|
| 480 |
|
strncpy(msg_f, msg, sizeof(msg_f) - 1); |
| 481 |
|
msg_f[sizeof(msg_f) - 1] = '\0'; |
| 482 |
|
|
| 483 |
|
len = split_line(msg_f, 20, &truncate, &msg_len); |
| 484 |
|
if (truncate) |
| 485 |
|
{ |
| 486 |
|
log_error("Status string is truncated\n"); |
| 487 |
|
msg_f[len] = '\0'; |
| 488 |
|
} |
| 489 |
|
|
| 490 |
|
len_username = (int)strnlen(BBS_username, sizeof(BBS_username)); |
| 491 |
|
|
| 492 |
time_online = time(0) - BBS_login_tm; |
time_online = time(0) - BBS_login_tm; |
| 493 |
tm_online = gmtime(&time_online); |
tm_online = gmtime(&time_online); |
| 494 |
|
|
| 495 |
moveto(SCREEN_ROWS, 0); |
moveto(SCREEN_ROWS, 0); |
| 496 |
clrtoeol(); |
clrtoeol(); |
| 497 |
prints("\033[1;44;33m[\033[36m%s\033[33m]%sÕʺÅ[\033[36m%s\033[33m]" |
prints("\033[1;44;33m[\033[36m%s\033[33m]%*s%*sÕʺÅ[\033[36m%s\033[33m]" |
| 498 |
"[\033[36m%1d\033[33m:\033[36m%2d\033[33m:\033[36m%2d\033[33m]\033[m", |
"[\033[36m%1d\033[33m:\033[36m%2d\033[33m:\033[36m%2d\033[33m]\033[m", |
| 499 |
str_time, space, BBS_username, tm_online->tm_mday - 1, |
str_time, 21, msg_f, 13 - len_username, "", BBS_username, |
| 500 |
tm_online->tm_hour, tm_online->tm_min); |
tm_online->tm_mday - 1, tm_online->tm_hour, tm_online->tm_min); |
| 501 |
iflush(); |
iflush(); |
| 502 |
|
|
| 503 |
return 0; |
return 0; |