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

Diff of /lbbs/src/menu.c

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

Revision 1.23 by sysadm, Fri May 2 03:34:58 2025 UTC Revision 1.25 by sysadm, Sun May 4 14:54:55 2025 UTC
# Line 31  Line 31 
31  #include <regex.h>  #include <regex.h>
32  #include <stdlib.h>  #include <stdlib.h>
33    
34    #define MENU_TEMP_DIR "var"
35    
36  MENU_SET bbs_menu;  MENU_SET bbs_menu;
37    
38  int load_menu(MENU_SET *p_menu_set, const char *conf_file)  int load_menu(MENU_SET *p_menu_set, const char *conf_file)
# Line 38  int load_menu(MENU_SET *p_menu_set, cons Line 40  int load_menu(MENU_SET *p_menu_set, cons
40          FILE *fin, *fout;          FILE *fin, *fout;
41          int i = 0, j;          int i = 0, j;
42          char buffer[LINE_BUFFER_LEN];          char buffer[LINE_BUFFER_LEN];
43          char screen_filename[LINE_BUFFER_LEN];          char screen_filename[FILE_PATH_LEN];
44          char temp[LINE_BUFFER_LEN];          char temp[LINE_BUFFER_LEN];
45          regmatch_t pmatch[10];          regmatch_t pmatch[10];
46    
# Line 62  int load_menu(MENU_SET *p_menu_set, cons Line 64  int load_menu(MENU_SET *p_menu_set, cons
64                                  strncpy(temp, buffer + pmatch[1].rm_so,                                  strncpy(temp, buffer + pmatch[1].rm_so,
65                                                  pmatch[1].rm_eo - pmatch[1].rm_so);                                                  pmatch[1].rm_eo - pmatch[1].rm_so);
66                                  temp[pmatch[1].rm_eo - pmatch[1].rm_so] = '\0';                                  temp[pmatch[1].rm_eo - pmatch[1].rm_so] = '\0';
67                                  sprintf(screen_filename, "%sMENU_SCR_%s", app_temp_dir, temp);                                  sprintf(screen_filename, "%s/MENU_SCR_%s", MENU_TEMP_DIR, temp);
68    
69                                  if ((fout = fopen(screen_filename, "w")) == NULL)                                  if ((fout = fopen(screen_filename, "w")) == NULL)
70                                  {                                  {
# Line 248  int load_menu(MENU_SET *p_menu_set, cons Line 250  int load_menu(MENU_SET *p_menu_set, cons
250                                                                  pmatch[3].rm_eo - pmatch[3].rm_so);                                                                  pmatch[3].rm_eo - pmatch[3].rm_so);
251                                                  temp[pmatch[3].rm_eo - pmatch[3].rm_so] = '\0';                                                  temp[pmatch[3].rm_eo - pmatch[3].rm_so] = '\0';
252                                                  sprintf(p_menu_set->p_menu[i]->screen.filename,                                                  sprintf(p_menu_set->p_menu[i]->screen.filename,
253                                                                  "%sMENU_SCR_%s", app_temp_dir, temp);                                                                  "%s/MENU_SCR_%s", MENU_TEMP_DIR, temp);
254                                                  continue;                                                  continue;
255                                          }                                          }
256                                  }                                  }
# Line 366  int menu_control(MENU_SET *p_menu_set, i Line 368  int menu_control(MENU_SET *p_menu_set, i
368          switch (key)          switch (key)
369          {          {
370          case CR:          case CR:
371                    igetch(1); // Cleanup remaining '\n' in the buffer
372          case KEY_RIGHT:          case KEY_RIGHT:
373                  if (p_menu->items[p_menu->item_cur_pos]->submenu)                  if (p_menu->items[p_menu->item_cur_pos]->submenu)
374                  {                  {
# Line 456  int menu_control(MENU_SET *p_menu_set, i Line 459  int menu_control(MENU_SET *p_menu_set, i
459  void unload_menu(MENU_SET *p_menu_set)  void unload_menu(MENU_SET *p_menu_set)
460  {  {
461          MENU *p_menu;          MENU *p_menu;
         MENU_ITEM *p_menuitem;  
462          int i, j;          int i, j;
463    
464          for (i = 0; i < p_menu_set->menu_count; i++)          for (i = 0; i < p_menu_set->menu_count; i++)


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

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