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

Diff of /lbbs/src/menu_proc.c

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

Revision 1.12 by sysadm, Thu May 8 08:05:58 2025 UTC Revision 1.23 by sysadm, Wed Jun 4 13:42:53 2025 UTC
# Line 21  Line 21 
21  #include "io.h"  #include "io.h"
22  #include "screen.h"  #include "screen.h"
23  #include "menu.h"  #include "menu.h"
24    #include "user_priv.h"
25    #include "section_list_display.h"
26  #include <dlfcn.h>  #include <dlfcn.h>
27  #include <errno.h>  #include <errno.h>
28  #include <signal.h>  #include <signal.h>
# Line 29  Line 31 
31  #include <time.h>  #include <time.h>
32  #include <unistd.h>  #include <unistd.h>
33    
34  int exec_mbem(const char *str)  int list_section(void *param)
35    {
36            section_list_display(param);
37    
38            return REDRAW;
39    }
40    
41    int exec_mbem(void *param)
42  {  {
43          void *hdll;          void *hdll;
44          int (*func)();          int (*func)();
45          char *c, *s;          char *c, *s;
46          char buf[FILE_PATH_LEN];          char buf[FILE_PATH_LEN];
47    
48          strncpy(buf, str, sizeof(buf) - 1);          strncpy(buf, (const char *)param, sizeof(buf) - 1);
49          buf[sizeof(buf) - 1] = '\0';          buf[sizeof(buf) - 1] = '\0';
50    
51          s = strstr(buf, "@mod:");          s = strstr(buf, "@mod:");
# Line 77  int exec_mbem(const char *str) Line 86  int exec_mbem(const char *str)
86          return REDRAW;          return REDRAW;
87  }  }
88    
89  int exitbbs(const char *s)  int exit_bbs(void *param)
90  {  {
91          return EXITBBS;          return EXITBBS;
92  }  }
93    
94  int license(const char *s)  int license(void *param)
95  {  {
96          display_file_ex(DATA_LICENSE, 1, 1);          display_file(DATA_LICENSE, 1, 0);
97    
98          return REDRAW;          return REDRAW;
99  }  }
100    
101  int copyright(const char *s)  int copyright(void *param)
102  {  {
103          display_file_ex(DATA_COPYRIGHT, 1, 1);          display_file(DATA_COPYRIGHT, 1, 1);
104    
105          return REDRAW;          return REDRAW;
106  }  }
107    
108  int reloadbbsmenu(const char *s)  int reload_bbs_conf(void *param)
109  {  {
         MENU_SET new_menu;  
   
110          clearscr();          clearscr();
111    
112          if (load_menu(&new_menu, CONF_MENU) < 0)          if (kill(getppid(), SIGHUP) < 0)
113          {          {
114                  log_error("Reload menu failed\n");                  log_error("Send SIGHUP signal failed (%d)\n", errno);
   
                 unload_menu(&new_menu);  
115    
116                  prints("菜单配置校验失败\r\n");                  prints("发送指令失败\r\n");
117          }          }
118          else          else
119          {          {
120                  unload_menu(&new_menu);                  prints("已发送指令\r\n");
   
                 if (kill(getppid(), SIG_RELOAD_MENU) < 0)  
                 {  
                         log_error("Send SIG_RELOAD_MENU signal failed (%d)\n", errno);  
           
                         prints("发送指令失败\r\n");  
                 }  
                 else  
                 {  
                         prints("已发送指令\r\n");  
                 }  
121          }          }
122    
123          press_any_key();          press_any_key();
# Line 131  int reloadbbsmenu(const char *s) Line 125  int reloadbbsmenu(const char *s)
125          return REDRAW;          return REDRAW;
126  }  }
127    
128  int shutdownbbs(const char *s)  int shutdown_bbs(void *param)
129  {  {
130          if (kill(0, SIGTERM) < 0)          log_common("Notify main process to exit\n");
131    
132            if (kill(getppid(), SIGTERM) < 0)
133          {          {
134                  log_error("Send SIGTERM signal failed (%d)\n", errno);                  log_error("Send SIGTERM signal failed (%d)\n", errno);
135          }          }
136    
137          return REDRAW;          return REDRAW;
138  }  }
139    
140    int favour_section_filter(void *param)
141    {
142            MENU_ITEM *p_menu_item = param;
143    
144            return (is_favor(&BBS_priv, p_menu_item->priv) && checklevel2(&BBS_priv, p_menu_item->level));
145    }


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

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