/[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.96 by sysadm, Thu Jun 12 12:53:49 2025 UTC Revision 1.100 by sysadm, Tue Jun 17 13:18:55 2025 UTC
# Line 24  Line 24 
24  #include "file_loader.h"  #include "file_loader.h"
25  #include <fcntl.h>  #include <fcntl.h>
26  #include <ctype.h>  #include <ctype.h>
27    #include <string.h>
28  #include <unistd.h>  #include <unistd.h>
29  #include <stdlib.h>  #include <stdlib.h>
30  #include <errno.h>  #include <errno.h>
# Line 32  Line 33 
33  #include <sys/param.h>  #include <sys/param.h>
34  #include <sys/shm.h>  #include <sys/shm.h>
35    
 #define _POSIX_C_SOURCE 200809L  
 #include <string.h>  
   
36  #define ACTIVE_BOARD_HEIGHT 8  #define ACTIVE_BOARD_HEIGHT 8
37    
38  #define STR_TOP_LEFT_MAX_LEN 40  #define STR_TOP_LEFT_MAX_LEN 40
# Line 301  int display_data(const void *p_data, lon Line 299  int display_data(const void *p_data, lon
299                                           percentile,                                           percentile,
300                                           ctx.msg);                                           ctx.msg);
301    
302                          len = split_line(buffer, SCREEN_COLS, &eol, &display_len);                          len = split_line(buffer, SCREEN_COLS, &eol, &display_len, 1);
303                          for (; display_len < SCREEN_COLS; display_len++)                          for (; display_len < SCREEN_COLS; display_len++)
304                          {                          {
305                                  buffer[len++] = ' ';                                  buffer[len++] = ' ';
# Line 431  int display_data(const void *p_data, lon Line 429  int display_data(const void *p_data, lon
429                                          break;                                          break;
430                                  }                                  }
431    
432                                  BBS_last_access_tm = time(0);                                  BBS_last_access_tm = time(NULL);
433                          }                          }
434    
435                          continue;                          continue;
# Line 518  int show_top(const char *str_left, const Line 516  int show_top(const char *str_left, const
516    
517          strncpy(str_left_f, str_left, sizeof(str_left_f) - 1);          strncpy(str_left_f, str_left, sizeof(str_left_f) - 1);
518          str_left_f[sizeof(str_left_f) - 1] = '\0';          str_left_f[sizeof(str_left_f) - 1] = '\0';
519          len = split_line(str_left_f, STR_TOP_LEFT_MAX_LEN, &eol, &str_left_len);          len = split_line(str_left_f, STR_TOP_LEFT_MAX_LEN, &eol, &str_left_len, 1);
520          str_left_f[len] = '\0';          str_left_f[len] = '\0';
521    
522          strncpy(str_middle_f, str_middle, sizeof(str_middle_f) - 1);          strncpy(str_middle_f, str_middle, sizeof(str_middle_f) - 1);
523          str_middle_f[sizeof(str_middle_f) - 1] = '\0';          str_middle_f[sizeof(str_middle_f) - 1] = '\0';
524          len = split_line(str_middle, STR_TOP_MIDDLE_MAX_LEN, &eol, &str_middle_len);          len = split_line(str_middle, STR_TOP_MIDDLE_MAX_LEN, &eol, &str_middle_len, 1);
525          str_middle_f[len] = '\0';          str_middle_f[len] = '\0';
526    
527          strncpy(str_right_f, str_right, sizeof(str_right_f) - 1);          strncpy(str_right_f, str_right, sizeof(str_right_f) - 1);
528          str_right_f[sizeof(str_right_f) - 1] = '\0';          str_right_f[sizeof(str_right_f) - 1] = '\0';
529          len = split_line(str_right, STR_TOP_RIGHT_MAX_LEN, &eol, &str_right_len);          len = split_line(str_right, STR_TOP_RIGHT_MAX_LEN, &eol, &str_right_len, 1);
530          str_right_f[len] = '\0';          str_right_f[len] = '\0';
531    
532          moveto(1, 0);          moveto(1, 0);
# Line 559  int show_bottom(const char *msg) Line 557  int show_bottom(const char *msg)
557          {          {
558                  strncpy(msg_f, msg, sizeof(msg_f) - 1);                  strncpy(msg_f, msg, sizeof(msg_f) - 1);
559                  msg_f[sizeof(msg_f) - 1] = '\0';                  msg_f[sizeof(msg_f) - 1] = '\0';
560                  len = split_line(msg_f, 23, &eol, &msg_len);                  len = split_line(msg_f, 23, &eol, &msg_len, 1);
561                  msg_f[len] = '\0';                  msg_f[len] = '\0';
562          }          }
563    
564          len_username = (int)strnlen(BBS_username, sizeof(BBS_username));          len_username = (int)strnlen(BBS_username, sizeof(BBS_username));
565    
566          time_online = time(0) - BBS_login_tm;          time_online = time(NULL) - BBS_login_tm;
567          tm_online = gmtime(&time_online);          tm_online = gmtime(&time_online);
568          if (tm_online->tm_mday > 1)          if (tm_online->tm_mday > 1)
569          {          {
# Line 612  int show_active_board() Line 610  int show_active_board()
610                  }                  }
611          }          }
612    
613          if (time(0) - t_last_show >= 10)          if (time(NULL) - t_last_show >= 10)
614          {          {
615                  line_last = line_current;                  line_last = line_current;
616                  t_last_show = time(0);                  t_last_show = time(NULL);
617          }          }
618          else          else
619          {          {


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

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