/[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.60 by sysadm, Sat May 17 12:28:47 2025 UTC Revision 1.61 by sysadm, Sun May 18 06:57:56 2025 UTC
# Line 232  int display_file_ex(const char *filename Line 232  int display_file_ex(const char *filename
232          int ch = KEY_NULL;          int ch = KEY_NULL;
233          int input_ok, line, max_lines;          int input_ok, line, max_lines;
234          long int line_current = 0;          long int line_current = 0;
235          const void *p_file_shm;          const void *p_shm;
         const void *p_data;  
236          size_t data_len;          size_t data_len;
237          long line_total;          long line_total;
238            const void *p_data;
239          const long *p_line_offsets;          const long *p_line_offsets;
240          long int len;          long int len;
241          long int percentile;          long int percentile;
242          int loop;          int loop;
243    
244          if ((p_file_shm = get_file_shm(filename)) == NULL)          if ((p_shm = get_file_shm(filename, &data_len, &line_total, &p_data, &p_line_offsets)) == NULL)
245          {          {
246                  log_error("get_file_shm(%s) error\n", filename);                  log_error("get_file_shm(%s) error\n", filename);
247                  return KEY_NULL;                  return KEY_NULL;
248          }          }
249    
         data_len = *((size_t *)p_file_shm);  
         line_total = *((long *)(p_file_shm + sizeof(size_t)));  
         p_data = p_file_shm + sizeof(data_len) + sizeof(line_total);  
         p_line_offsets = p_data + data_len + 1;  
   
250          clrline(begin_line, SCREEN_ROWS);          clrline(begin_line, SCREEN_ROWS);
251          line = begin_line;          line = begin_line;
252          max_lines = SCREEN_ROWS - 1;          max_lines = SCREEN_ROWS - 1;
# Line 423  int display_file_ex(const char *filename Line 418  int display_file_ex(const char *filename
418          }          }
419    
420  cleanup:  cleanup:
         if (shmdt(p_file_shm) == -1)  
         {  
                 log_error("shmdt() error (%d)\n", errno);  
         }  
   
421          return ch;          return ch;
422  }  }
423    
# Line 506  int show_bottom(const char *msg) Line 496  int show_bottom(const char *msg)
496  int show_active_board()  int show_active_board()
497  {  {
498          static int line_current = 0;          static int line_current = 0;
499          static const void *p_file_shm = NULL;          static const void *p_shm = NULL;
         static const void *p_data;  
500          static size_t data_len;          static size_t data_len;
501          static long line_total;          static long line_total;
502            static const void *p_data;
503          static const long *p_line_offsets;          static const long *p_line_offsets;
504    
505          char buffer[LINE_BUFFER_LEN];          char buffer[LINE_BUFFER_LEN];
506          long int len;          long int len;
507    
508          if (p_file_shm == NULL)          if (p_shm == NULL)
509          {          {
510                  if ((p_file_shm = get_file_shm(DATA_ACTIVE_BOARD)) == NULL)                  if ((p_shm = get_file_shm(DATA_ACTIVE_BOARD, &data_len, &line_total, &p_data, &p_line_offsets)) == NULL)
511                  {                  {
512                          log_error("get_file_shm(%s) error\n", DATA_ACTIVE_BOARD);                          log_error("get_file_shm(%s) error\n", DATA_ACTIVE_BOARD);
513                          return KEY_NULL;                          return KEY_NULL;
514                  }                  }
   
                 data_len = *((size_t *)p_file_shm);  
                 line_total = *((long *)(p_file_shm + sizeof(size_t)));  
                 p_data = p_file_shm + sizeof(data_len) + sizeof(line_total);  
                 p_line_offsets = p_data + data_len + 1;  
515          }          }
516    
517          clrline(3, 2 + ACTIVE_BOARD_HEIGHT);          clrline(3, 2 + ACTIVE_BOARD_HEIGHT);


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

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