| 438 |
len = p_line_offsets[line_current + 1] - p_line_offsets[line_current]; |
len = p_line_offsets[line_current + 1] - p_line_offsets[line_current]; |
| 439 |
if (len >= LINE_BUFFER_LEN) |
if (len >= LINE_BUFFER_LEN) |
| 440 |
{ |
{ |
| 441 |
log_error("buffer overflow: len=%ld(%ld - %ld) line=%ld \n", |
log_error("Buffer overflow: len=%ld(%ld - %ld) line=%ld \n", |
| 442 |
len, p_line_offsets[line_current + 1], p_line_offsets[line_current], line_current); |
len, p_line_offsets[line_current + 1], p_line_offsets[line_current], line_current); |
| 443 |
len = LINE_BUFFER_LEN - 1; |
len = LINE_BUFFER_LEN - 1; |
| 444 |
} |
} |
| 445 |
|
else if (len < 0) |
| 446 |
|
{ |
| 447 |
|
log_error("Incorrect line offsets: len=%ld(%ld - %ld) line=%ld \n", |
| 448 |
|
len, p_line_offsets[line_current + 1], p_line_offsets[line_current], line_current); |
| 449 |
|
len = 0; |
| 450 |
|
} |
| 451 |
|
|
| 452 |
memcpy(buffer, (const char *)p_data + p_line_offsets[line_current], (size_t)len); |
memcpy(buffer, (const char *)p_data + p_line_offsets[line_current], (size_t)len); |
| 453 |
buffer[len] = '\0'; |
buffer[len] = '\0'; |
| 469 |
{ |
{ |
| 470 |
case 0: // Set msg |
case 0: // Set msg |
| 471 |
snprintf(p_ctx->msg, sizeof(p_ctx->msg), |
snprintf(p_ctx->msg, sizeof(p_ctx->msg), |
| 472 |
"| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] │ " |
"| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] | " |
| 473 |
"移动[\033[32m↑\033[33m/\033[32m↓\033[33m/\033[32mPgUp\033[33m/\033[32mPgDn\033[33m] │ " |
"移动[\033[32m↑\033[33m/\033[32m↓\033[33m/\033[32mPgUp\033[33m/\033[32mPgDn\033[33m] | " |
| 474 |
"帮助[\033[32mh\033[33m] |"); |
"帮助[\033[32mh\033[33m] |"); |
| 475 |
break; |
break; |
| 476 |
} |
} |
| 547 |
int msg_len; |
int msg_len; |
| 548 |
int len; |
int len; |
| 549 |
int len_username; |
int len_username; |
| 550 |
|
char str_tm_online[LINE_BUFFER_LEN]; |
| 551 |
|
|
| 552 |
get_time_str(str_time, sizeof(str_time)); |
get_time_str(str_time, sizeof(str_time)); |
| 553 |
|
|
| 565 |
|
|
| 566 |
time_online = time(0) - BBS_login_tm; |
time_online = time(0) - BBS_login_tm; |
| 567 |
tm_online = gmtime(&time_online); |
tm_online = gmtime(&time_online); |
| 568 |
|
if (tm_online->tm_mday > 1) |
| 569 |
|
{ |
| 570 |
|
snprintf(str_tm_online, sizeof(str_tm_online), |
| 571 |
|
"\033[36m%2d\033[33m天\033[36m%2d\033[33m时", |
| 572 |
|
tm_online->tm_mday - 1, tm_online->tm_hour); |
| 573 |
|
} |
| 574 |
|
else |
| 575 |
|
{ |
| 576 |
|
snprintf(str_tm_online, sizeof(str_tm_online), |
| 577 |
|
"\033[36m%2d\033[33m时\033[36m%2d\033[33m分", |
| 578 |
|
tm_online->tm_hour, tm_online->tm_min); |
| 579 |
|
} |
| 580 |
|
|
| 581 |
moveto(SCREEN_ROWS, 0); |
moveto(SCREEN_ROWS, 0); |
| 582 |
clrtoeol(); |
clrtoeol(); |
| 583 |
prints("\033[1;44;33m时间[\033[36m%s\033[33m]%s%*s \033[33m帐号[\033[36m%s\033[33m]" |
prints("\033[1;44;33m时间[\033[36m%s\033[33m]%s%*s \033[33m帐号[\033[36m%s\033[33m][%s\033[33m]\033[m", |
| 584 |
"[\033[36m%1d\033[33m天\033[36m%2d\033[33m时\033[36m%2d\033[33m分]\033[m", |
str_time, msg_f, 38 - msg_len - len_username, "", BBS_username, str_tm_online); |
|
str_time, msg_f, 35 - msg_len - len_username, "", BBS_username, |
|
|
tm_online->tm_mday - 1, tm_online->tm_hour, tm_online->tm_min); |
|
| 585 |
|
|
| 586 |
return 0; |
return 0; |
| 587 |
} |
} |