/[LeafOK_CVS]/lbbs/src/screen.c
ViewVC logotype

Diff of /lbbs/src/screen.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.57 by sysadm, Sat May 17 06:46:23 2025 UTC Revision 1.58 by sysadm, Sat May 17 11:30:09 2025 UTC
# Line 298  int display_file_ex(const char *filename Line 298  int display_file_ex(const char *filename
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:
# Line 433  cleanup: Line 433  cleanup:
433    
434  int show_top(const 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;
         char status_f[21];  
441    
442          strncpy(status_f, status, sizeof(status_f) - 1);          strncpy(status_f, status, sizeof(status_f) - 1);
443          status_f[sizeof(status_f) - 1] = '\0';          status_f[sizeof(status_f) - 1] = '\0';
# Line 457  int show_top(const char *status) Line 457  int show_top(const char *status)
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_f, (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;
# Line 469  int show_bottom(const char *msg) Line 469  int show_bottom(const char *msg)
469          char str_time[LINE_BUFFER_LEN];          char str_time[LINE_BUFFER_LEN];
470          time_t time_online;          time_t time_online;
471          struct tm *tm_online;          struct tm *tm_online;
472          int len_username = (int)strnlen(BBS_username, sizeof(BBS_username));          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    
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, 34 - len_username, "", BBS_username,                     str_time, 21, msg_f, 13 - len_username, "", BBS_username,
500                     tm_online->tm_mday - 1, 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    


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1