/[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.81 by sysadm, Fri May 30 05:28:41 2025 UTC Revision 1.82 by sysadm, Fri May 30 12:51:00 2025 UTC
# Line 233  int get_data(int row, int col, char *pro Line 233  int get_data(int row, int col, char *pro
233          return len;          return len;
234  }  }
235    
236  int display_data(const void *p_data, long line_total, const long *p_line_offsets, int begin_line, int wait,  int display_data(const void *p_data, long line_total, const long *p_line_offsets, int begin_line, int eof_exit,
237                                   display_data_key_handler key_handler, const char *help_filename)                                   display_data_key_handler key_handler, const char *help_filename)
238  {  {
239          static int show_help = 1;          static int show_help = 1;
# Line 260  int display_data(const void *p_data, lon Line 260  int display_data(const void *p_data, lon
260          loop = 1;          loop = 1;
261          while (!SYS_server_exit && loop)          while (!SYS_server_exit && loop)
262          {          {
263                  if (line_current >= line_total && line_total <= SCREEN_ROWS - 2)                  if (eof_exit > 0 && line_current >= line_total && line_total <= SCREEN_ROWS - 2)
264                  {                  {
265                          if (wait)                          if (eof_exit == 1)
266                          {                          {
267                                  ch = press_any_key();                                  ch = press_any_key();
268                          }                          }
269                          else                          else // if (eof_exit == 2)
270                          {                          {
271                                  iflush();                                  iflush();
272                          }                          }
# Line 445  cleanup: Line 445  cleanup:
445    
446  static int display_file_key_handler(int *key, char *msg, size_t msg_len)  static int display_file_key_handler(int *key, char *msg, size_t msg_len)
447  {  {
         static int topic_view = 0;  
   
448          switch (*key)          switch (*key)
449          {          {
450          case 0: // Set msg          case 0: // Set msg
# Line 455  static int display_file_key_handler(int Line 453  static int display_file_key_handler(int
453                                   "移动[\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] │ "
454                                   "帮助[\033[32mh\033[33m] |");                                   "帮助[\033[32mh\033[33m] |");
455                  break;                  break;
         case 'p':  
                 break;  
                 topic_view = !topic_view;  
                 if (topic_view)  
                 {  
                         snprintf(msg, msg_len,  
                                          "| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] │ "  
                                          "同主题阅读[\033[32m↑\033[33m/\033[32m↓\033[33m] │ "  
                                          "帮助[\033[32mh\033[33m] |");  
                 }  
                 else  
                 {  
                         snprintf(msg, msg_len,  
                                          "| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] │ "  
                                          "移动[\033[32m↑\033[33m/\033[32m↓\033[33m/\033[32mPgUp\033[33m/\033[32mPgDn\033[33m] │ "  
                                          "帮助[\033[32mh\033[33m] |");  
                 }  
                 *key = 0;  
                 break;  
456          case 'H':          case 'H':
457                  *key = 'h';                  *key = 'h';
458                  return 0;                  return 0;
# Line 482  static int display_file_key_handler(int Line 461  static int display_file_key_handler(int
461          return 0;          return 0;
462  }  }
463    
464  int display_file(const char *filename, int begin_line, int wait)  int display_file(const char *filename, int begin_line, int eof_exit)
465  {  {
466          int ret;          int ret;
467          const void *p_shm;          const void *p_shm;
# Line 497  int display_file(const char *filename, i Line 476  int display_file(const char *filename, i
476                  return KEY_NULL;                  return KEY_NULL;
477          }          }
478    
479          ret = display_data(p_data, line_total, p_line_offsets, begin_line, wait, display_file_key_handler, DATA_READ_HELP);          ret = display_data(p_data, line_total, p_line_offsets, begin_line, eof_exit, display_file_key_handler, DATA_READ_HELP);
480    
481          if (detach_file_shm(p_shm) < 0)          if (detach_file_shm(p_shm) < 0)
482          {          {


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

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