/[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.1 by sysadm, Fri May 6 15:50:23 2005 UTC Revision 1.6 by sysadm, Mon Apr 28 03:31:00 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2                            menu_proc.c  -  description                                                    menu_proc.c  -  description
3                               -------------------                                                           -------------------
4      begin                : Fri May 6 2005          begin                : Fri May 6 2005
5      copyright            : (C) 2005 by Leaflet          copyright            : (C) 2005 by Leaflet
6      email                : leaflet@leafok.com          email                : leaflet@leafok.com
7   ***************************************************************************/   ***************************************************************************/
8    
9  /***************************************************************************  /***************************************************************************
# Line 20  Line 20 
20  #include "common.h"  #include "common.h"
21  #include "io.h"  #include "io.h"
22  #include <dlfcn.h>  #include <dlfcn.h>
23  #include <time.h>  #include <errno.h>
24    #include <signal.h>
25  #include <string.h>  #include <string.h>
26    #include <sys/types.h>
27    #include <time.h>
28    #include <unistd.h>
29    
30  int  int exec_mbem(const char *str)
 exec_mbem(const char *str)  
31  {  {
32      void *hdll;          void *hdll;
33      int (*func) ();          int (*func)();
34      char *c,*s;          char *c, *s;
35      char buf[1024];          char buf[1024];
36    
37      strcpy(buf, str);          strcpy(buf, str);
38      s = strstr(buf, "@mod:");          s = strstr(buf, "@mod:");
39      if (s) {          if (s)
40          c = strstr(s + 5, "#");          {
41          if (c) {                  c = strstr(s + 5, "#");
42              *c = 0;                  if (c)
43              c++;                  {
44          }                          *c = 0;
45                            c++;
46          hdll = dlopen (s + 5, RTLD_LAZY);                  }
47    
48          if (hdll) {                  hdll = dlopen(s + 5, RTLD_LAZY);
49              char *error;  
50                    if (hdll)
51              if ((func = dlsym (hdll, c ? c : "mod_main")) != NULL)                  {
52                  func ();                          char *error;
53              else if ((error = dlerror ()) != NULL) {  
54                  clearscr ();                          if ((func = dlsym(hdll, c ? c : "mod_main")) != NULL)
55                  prints ("%s\n", error);                                  func();
56                  press_any_key ();                          else if ((error = dlerror()) != NULL)
57              }                          {
58              dlclose (hdll);                                  clearscr();
59          } else {                                  prints("%s\r\n", error);
60              clearscr ();                                  press_any_key();
61              prints ("加载库文件 [%s] 失败!!\n\n", s + 5);                          }
62              prints ("失败原因:%s", dlerror());                          dlclose(hdll);
63              press_any_key ();                  }
64          }                  else
65      }                  {
66                            clearscr();
67          return REDRAW;                          prints("加载库文件 [%s] 失败!!\r\n", s + 5);
68                            prints("失败原因:%s\r\n", dlerror());
69                            press_any_key();
70                    }
71            }
72    
73            return REDRAW;
74  }  }
75    
76  int  int exitbbs(const char *s)
 exitbbs (const char *s)  
77  {  {
78          return EXITBBS;          return EXITBBS;
79  }  }
80    
81  int  int license(const char *s)
 license (const char *s)  
82  {  {
83          char temp[256];          char temp[256];
           
     strcpy (temp, app_home_dir);  
     strcat (temp, "data/license.txt");  
     display_file_ex (temp, 0, 1);  
84    
85          return REDRAW;          strcpy(temp, app_home_dir);
86            strcat(temp, "data/license.txt");
87            display_file_ex(temp, 0, 1);
88    
89            return REDRAW;
90  }  }
91    
92  int  int copyright(const char *s)
 copyright (const char *s)  
93  {  {
94          char temp[256];          char temp[256];
           
     strcpy (temp, app_home_dir);  
     strcat (temp, "data/copyright.txt");  
     display_file_ex (temp, 0, 1);  
95    
96          return REDRAW;          strcpy(temp, app_home_dir);
97            strcat(temp, "data/copyright.txt");
98            display_file_ex(temp, 0, 1);
99    
100            return REDRAW;
101    }
102    
103    int reloadbbsmenu(const char *s)
104    {
105            if (kill(getppid(), SIG_RELOAD_MENU) < 0)
106                    log_error("Send SIG_RELOAD_MENU signal failed (%d)\n", errno);
107    
108            return REDRAW;
109    }
110    
111    int shutdownbbs(const char *s)
112    {
113            if (kill(0, SIGTERM) < 0)
114                    log_error("Send SIGTERM signal failed (%d)\n", errno);
115    
116            return REDRAW;
117  }  }


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

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