| 20 |
#include <string.h> |
#include <string.h> |
| 21 |
#include <time.h> |
#include <time.h> |
| 22 |
#include <sys/types.h> |
#include <sys/types.h> |
|
#include <sys/wait.h> |
|
| 23 |
|
|
| 24 |
// Version information |
// Version information |
| 25 |
char app_version[256] = "LBBS-devel version 1.0"; |
char app_version[256] = "LBBS-devel version 1.0"; |
| 33 |
int port_client; |
int port_client; |
| 34 |
|
|
| 35 |
// Global declaration for system |
// Global declaration for system |
| 36 |
int SYS_exit; |
volatile int SYS_server_exit = 0; |
| 37 |
int SYS_child_process_count; |
volatile int SYS_child_process_count = 0; |
| 38 |
|
volatile int SYS_child_exit_count = 0; |
| 39 |
|
volatile int SYS_menu_reload = 0; |
| 40 |
|
|
| 41 |
// Common function |
// Common function |
| 42 |
const char *str_space(char *string, int length) |
const char *str_space(char *string, int length) |
| 91 |
return s; |
return s; |
| 92 |
} |
} |
| 93 |
|
|
| 94 |
void reload_bbs_menu(int i) |
void sig_hup_handler(int i) |
| 95 |
{ |
{ |
| 96 |
if (reload_menu(&bbs_menu) < 0) |
SYS_menu_reload = 1; |
|
{ |
|
|
log_error("Reload menu failed\n"); |
|
|
} |
|
|
else |
|
|
{ |
|
|
log_std("Reload menu successfully\n"); |
|
|
} |
|
| 97 |
} |
} |
| 98 |
|
|
| 99 |
void system_exit(int i) |
void sig_term_handler(int i) |
| 100 |
{ |
{ |
| 101 |
SYS_exit = 1; |
SYS_server_exit = 1; |
| 102 |
} |
} |
| 103 |
|
|
| 104 |
void child_exit(int i) |
void sig_chld_handler(int i) |
| 105 |
{ |
{ |
| 106 |
int pid; |
SYS_child_exit_count++; |
|
|
|
|
pid = wait(0); |
|
|
|
|
|
if (pid > 0) |
|
|
{ |
|
|
SYS_child_process_count--; |
|
|
log_std("Child process (%d) exited\n", pid); |
|
|
} |
|
| 107 |
} |
} |
| 108 |
|
|
| 109 |
const char * ip_mask(char * s, int level, char mask) |
const char * ip_mask(char * s, int level, char mask) |