/[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.95 by sysadm, Thu Jun 12 03:14:23 2025 UTC Revision 1.98 by sysadm, Mon Jun 16 14:30:44 2025 UTC
# Line 14  Line 14 
14   *                                                                         *   *                                                                         *
15   ***************************************************************************/   ***************************************************************************/
16    
17    #define _POSIX_C_SOURCE 200809L
18    
19  #include "screen.h"  #include "screen.h"
20  #include "bbs.h"  #include "bbs.h"
21  #include "common.h"  #include "common.h"
# Line 24  Line 26 
26  #include "file_loader.h"  #include "file_loader.h"
27  #include <fcntl.h>  #include <fcntl.h>
28  #include <ctype.h>  #include <ctype.h>
29    #include <string.h>
30  #include <unistd.h>  #include <unistd.h>
31  #include <stdlib.h>  #include <stdlib.h>
32  #include <errno.h>  #include <errno.h>
# Line 32  Line 35 
35  #include <sys/param.h>  #include <sys/param.h>
36  #include <sys/shm.h>  #include <sys/shm.h>
37    
 #define _POSIX_C_SOURCE 200809L  
 #include <string.h>  
   
38  #define ACTIVE_BOARD_HEIGHT 8  #define ACTIVE_BOARD_HEIGHT 8
39    
40  #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 301  int display_data(const void *p_data, lon
301                                           percentile,                                           percentile,
302                                           ctx.msg);                                           ctx.msg);
303    
304                          len = split_line(buffer, SCREEN_COLS, &eol, &display_len);                          len = split_line(buffer, SCREEN_COLS, &eol, &display_len, 1);
305                          for (; display_len < SCREEN_COLS; display_len++)                          for (; display_len < SCREEN_COLS; display_len++)
306                          {                          {
307                                  buffer[len++] = ' ';                                  buffer[len++] = ' ';
# Line 424  int display_data(const void *p_data, lon Line 424  int display_data(const void *p_data, lon
424                                          output_end_row = SCREEN_ROWS - 1;                                          output_end_row = SCREEN_ROWS - 1;
425                                          clrline(output_current_row, SCREEN_ROWS);                                          clrline(output_current_row, SCREEN_ROWS);
426                                          break;                                          break;
                                 case KEY_F2: // For test only  
                                         EDITOR_DATA *p_editor_data;  
                                         size_t data_new_len = strlen(p_data) + LINE_BUFFER_LEN;  
   
                                         char *p_data_new = malloc(data_new_len);  
                                         if (p_data_new == NULL)  
                                         {  
                                                 break;  
                                         }  
                                         p_editor_data = editor_data_load(p_data);  
                                         if (p_editor_data == NULL)  
                                         {  
                                                 free(p_data_new);  
                                                 break;  
                                         }  
   
                                         editor_display(p_editor_data);  
                                         editor_data_save(p_editor_data, p_data_new, data_new_len);  
                                         editor_data_cleanup(p_editor_data);  
                                         p_editor_data = NULL;  
                                         free(p_data_new);  
                                         p_data_new = NULL;  
   
                                         // Refresh after display editor  
                                         line_current -= (output_current_row - screen_begin_row);  
                                         output_current_row = screen_begin_row;  
                                         output_end_row = SCREEN_ROWS - 1;  
                                         clrline(output_current_row, SCREEN_ROWS);  
                                         break;  
427                                  case 0: // Refresh bottom line                                  case 0: // Refresh bottom line
428                                          break;                                          break;
429                                  default:                                  default:
# Line 547  int show_top(const char *str_left, const Line 518  int show_top(const char *str_left, const
518    
519          strncpy(str_left_f, str_left, sizeof(str_left_f) - 1);          strncpy(str_left_f, str_left, sizeof(str_left_f) - 1);
520          str_left_f[sizeof(str_left_f) - 1] = '\0';          str_left_f[sizeof(str_left_f) - 1] = '\0';
521          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);
522          str_left_f[len] = '\0';          str_left_f[len] = '\0';
523    
524          strncpy(str_middle_f, str_middle, sizeof(str_middle_f) - 1);          strncpy(str_middle_f, str_middle, sizeof(str_middle_f) - 1);
525          str_middle_f[sizeof(str_middle_f) - 1] = '\0';          str_middle_f[sizeof(str_middle_f) - 1] = '\0';
526          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);
527          str_middle_f[len] = '\0';          str_middle_f[len] = '\0';
528    
529          strncpy(str_right_f, str_right, sizeof(str_right_f) - 1);          strncpy(str_right_f, str_right, sizeof(str_right_f) - 1);
530          str_right_f[sizeof(str_right_f) - 1] = '\0';          str_right_f[sizeof(str_right_f) - 1] = '\0';
531          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);
532          str_right_f[len] = '\0';          str_right_f[len] = '\0';
533    
534          moveto(1, 0);          moveto(1, 0);
# Line 588  int show_bottom(const char *msg) Line 559  int show_bottom(const char *msg)
559          {          {
560                  strncpy(msg_f, msg, sizeof(msg_f) - 1);                  strncpy(msg_f, msg, sizeof(msg_f) - 1);
561                  msg_f[sizeof(msg_f) - 1] = '\0';                  msg_f[sizeof(msg_f) - 1] = '\0';
562                  len = split_line(msg_f, 23, &eol, &msg_len);                  len = split_line(msg_f, 23, &eol, &msg_len, 1);
563                  msg_f[len] = '\0';                  msg_f[len] = '\0';
564          }          }
565    


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

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