| 1 |
/*************************************************************************** |
/*************************************************************************** |
| 2 |
menu_proc.c - description |
menu_proc.c - description |
| 3 |
------------------- |
------------------- |
| 4 |
begin : Fri May 6 2005 |
Copyright : (C) 2004-2025 by Leaflet |
| 5 |
copyright : (C) 2005 by Leaflet |
Email : leaflet@leafok.com |
|
email : leaflet@leafok.com |
|
| 6 |
***************************************************************************/ |
***************************************************************************/ |
| 7 |
|
|
| 8 |
/*************************************************************************** |
/*************************************************************************** |
| 9 |
* * |
* * |
| 10 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
| 11 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
| 12 |
* the Free Software Foundation; either version 2 of the License, or * |
* the Free Software Foundation; either version 3 of the License, or * |
| 13 |
* (at your option) any later version. * |
* (at your option) any later version. * |
| 14 |
* * |
* * |
| 15 |
***************************************************************************/ |
***************************************************************************/ |
| 20 |
#include "log.h" |
#include "log.h" |
| 21 |
#include "io.h" |
#include "io.h" |
| 22 |
#include "screen.h" |
#include "screen.h" |
| 23 |
|
#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> |
| 29 |
#include <string.h> |
#include <string.h> |
|
#include <sys/types.h> |
|
| 30 |
#include <time.h> |
#include <time.h> |
| 31 |
#include <unistd.h> |
#include <unistd.h> |
| 32 |
|
#include <sys/types.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[1024]; |
char buf[FILE_PATH_LEN]; |
| 47 |
|
|
| 48 |
|
strncpy(buf, (const char *)param, sizeof(buf) - 1); |
| 49 |
|
buf[sizeof(buf) - 1] = '\0'; |
| 50 |
|
|
|
strcpy(buf, str); |
|
| 51 |
s = strstr(buf, "@mod:"); |
s = strstr(buf, "@mod:"); |
| 52 |
if (s) |
if (s) |
| 53 |
{ |
{ |
| 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, 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); |
| 104 |
|
|
| 105 |
return REDRAW; |
return REDRAW; |
| 106 |
} |
} |
| 107 |
|
|
| 108 |
int reloadbbsmenu(const char *s) |
int reload_bbs_conf(void *param) |
| 109 |
{ |
{ |
| 110 |
if (kill(getppid(), SIG_RELOAD_MENU) < 0) |
clearscr(); |
| 111 |
|
|
| 112 |
|
if (kill(getppid(), SIGHUP) < 0) |
| 113 |
{ |
{ |
| 114 |
log_error("Send SIG_RELOAD_MENU signal failed (%d)\n", errno); |
log_error("Send SIGHUP signal failed (%d)\n", errno); |
| 115 |
|
|
| 116 |
|
prints("发送指令失败\r\n"); |
| 117 |
|
} |
| 118 |
|
else |
| 119 |
|
{ |
| 120 |
|
prints("已发送指令\r\n"); |
| 121 |
} |
} |
| 122 |
|
|
| 123 |
|
press_any_key(); |
| 124 |
|
|
| 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 |
|
} |