| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
menu_proc.c - description |
/* |
| 3 |
------------------- |
* menu_proc |
| 4 |
Copyright : (C) 2004-2025 by Leaflet |
* - handler functions of menu commands |
| 5 |
Email : leaflet@leafok.com |
* |
| 6 |
***************************************************************************/ |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
|
*/ |
| 8 |
/*************************************************************************** |
|
| 9 |
* * |
#ifdef HAVE_CONFIG_H |
| 10 |
* This program is free software; you can redistribute it and/or modify * |
#include "config.h" |
| 11 |
* it under the terms of the GNU General Public License as published by * |
#endif |
|
* the Free Software Foundation; either version 3 of the License, or * |
|
|
* (at your option) any later version. * |
|
|
* * |
|
|
***************************************************************************/ |
|
| 12 |
|
|
| 13 |
#include "article_cache.h" |
#include "article_cache.h" |
| 14 |
#include "article_favor_display.h" |
#include "article_favor_display.h" |
| 22 |
#include "menu.h" |
#include "menu.h" |
| 23 |
#include "section_list_display.h" |
#include "section_list_display.h" |
| 24 |
#include "screen.h" |
#include "screen.h" |
| 25 |
|
#include "user_info_update.h" |
| 26 |
#include "user_list_display.h" |
#include "user_list_display.h" |
| 27 |
#include "user_priv.h" |
#include "user_priv.h" |
| 28 |
|
#include <ctype.h> |
| 29 |
#include <dlfcn.h> |
#include <dlfcn.h> |
| 30 |
#include <errno.h> |
#include <errno.h> |
| 31 |
#include <signal.h> |
#include <signal.h> |
| 42 |
return REDRAW; |
return REDRAW; |
| 43 |
} |
} |
| 44 |
|
|
| 45 |
typedef union exec_handler_t{ |
typedef union exec_handler_t |
| 46 |
|
{ |
| 47 |
void *p; |
void *p; |
| 48 |
int (*handler)(); |
int (*handler)(); |
| 49 |
} exec_handler; |
} exec_handler; |
| 146 |
|
|
| 147 |
int shutdown_bbs(void *param) |
int shutdown_bbs(void *param) |
| 148 |
{ |
{ |
| 149 |
log_common("Notify main process to exit\n"); |
char buf[2] = "N"; |
| 150 |
|
|
| 151 |
|
clearscr(); |
| 152 |
|
get_data(1, 1, "真的要关闭系统吗[y/N]? ", buf, sizeof(buf), 1); |
| 153 |
|
|
| 154 |
if (kill(getppid(), SIGTERM) < 0) |
if (toupper(buf[0]) == 'Y') |
| 155 |
{ |
{ |
| 156 |
log_error("Send SIGTERM signal failed (%d)\n", errno); |
log_common("Notify main process to exit by [%s]\n", BBS_username); |
| 157 |
|
|
| 158 |
|
if (kill(getppid(), SIGTERM) < 0) |
| 159 |
|
{ |
| 160 |
|
log_error("Send SIGTERM signal failed (%d)\n", errno); |
| 161 |
|
} |
| 162 |
} |
} |
| 163 |
|
|
| 164 |
return REDRAW; |
return REDRAW; |
| 283 |
show_top10 = 0; |
show_top10 = 0; |
| 284 |
return 0; |
return 0; |
| 285 |
case KEY_TIMEOUT: |
case KEY_TIMEOUT: |
| 286 |
if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME) |
if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time) |
| 287 |
{ |
{ |
| 288 |
log_error("User input timeout\n"); |
log_error("User input timeout\n"); |
| 289 |
show_top10 = 0; |
show_top10 = 0; |
| 370 |
} |
} |
| 371 |
|
|
| 372 |
return REDRAW; |
return REDRAW; |
| 373 |
|
} |
| 374 |
|
|
| 375 |
|
int edit_intro(void *param) |
| 376 |
|
{ |
| 377 |
|
if (user_intro_edit(BBS_priv.uid) < 0) |
| 378 |
|
{ |
| 379 |
|
log_error("user_intro_edit(%d) error\n", BBS_priv.uid); |
| 380 |
|
} |
| 381 |
|
|
| 382 |
|
return REDRAW; |
| 383 |
} |
} |