--- lbbs/src/menu_proc.c 2025/05/06 05:31:26 1.11 +++ lbbs/src/menu_proc.c 2025/05/17 15:39:51 1.16 @@ -20,6 +20,7 @@ #include "log.h" #include "io.h" #include "screen.h" +#include "menu.h" #include #include #include @@ -28,14 +29,14 @@ #include #include -int exec_mbem(const char *str) +int exec_mbem(void *param) { void *hdll; int (*func)(); char *c, *s; char buf[FILE_PATH_LEN]; - strncpy(buf, str, sizeof(buf) - 1); + strncpy(buf, (const char *)param, sizeof(buf) - 1); buf[sizeof(buf) - 1] = '\0'; s = strstr(buf, "@mod:"); @@ -76,38 +77,50 @@ int exec_mbem(const char *str) return REDRAW; } -int exitbbs(const char *s) +int exitbbs(void *param) { return EXITBBS; } -int license(const char *s) +int license(void *param) { display_file_ex(DATA_LICENSE, 1, 1); return REDRAW; } -int copyright(const char *s) +int copyright(void *param) { display_file_ex(DATA_COPYRIGHT, 1, 1); return REDRAW; } -int reloadbbsmenu(const char *s) +int reloadbbsmenu(void *param) { - if (kill(getppid(), SIG_RELOAD_MENU) < 0) + clearscr(); + + if (kill(getppid(), SIGHUP) < 0) + { + log_error("Send SIGHUP signal failed (%d)\n", errno); + + prints("发送指令失败\r\n"); + } + else { - log_error("Send SIG_RELOAD_MENU signal failed (%d)\n", errno); + prints("已发送指令\r\n"); } + press_any_key(); + return REDRAW; } -int shutdownbbs(const char *s) +int shutdownbbs(void *param) { - if (kill(0, SIGTERM) < 0) + log_std("Notify main process to exit\n"); + + if (kill(getppid(), SIGTERM) < 0) { log_error("Send SIGTERM signal failed (%d)\n", errno); }