| 17 |
|
|
| 18 |
#include "bbs.h" |
#include "bbs.h" |
| 19 |
#include "common.h" |
#include "common.h" |
| 20 |
|
#include "io.h" |
| 21 |
|
#include "menu.h" |
| 22 |
|
#include <string.h> |
| 23 |
|
|
| 24 |
void |
void |
| 25 |
app_help(void) |
app_help(void) |
| 26 |
{ |
{ |
| 27 |
printf ( |
prints ( |
| 28 |
"Usage: bbsd [-fhv] [...]\n\n" |
"Usage: bbsd [-fhv] [...]\n\n" |
| 29 |
"-f\t--foreground\t\tForce program run in foreground\n" |
"-f\t--foreground\t\tForce program run in foreground\n" |
| 30 |
"-h\t--help\t\t\tDisplay this help message\n" |
"-h\t--help\t\t\tDisplay this help message\n" |
| 38 |
void |
void |
| 39 |
arg_error(void) |
arg_error(void) |
| 40 |
{ |
{ |
| 41 |
printf ("Invalid arguments\n"); |
prints ("Invalid arguments\n"); |
| 42 |
app_help(); |
app_help(); |
| 43 |
} |
} |
| 44 |
|
|
| 112 |
|
|
| 113 |
//Initialize log |
//Initialize log |
| 114 |
strncpy(app_home_dir, argv[0], rindex(argv[0],'/')-argv[0]+1); |
strncpy(app_home_dir, argv[0], rindex(argv[0],'/')-argv[0]+1); |
| 115 |
|
strcat(app_home_dir, "../"); |
| 116 |
strcpy(log_dir, app_home_dir); |
strcpy(log_dir, app_home_dir); |
| 117 |
strcat(log_dir, "log/"); |
strcat(log_dir, "log/"); |
| 118 |
strcpy(file_log_std, log_dir); |
strcpy(file_log_std, log_dir); |
| 133 |
if (load_conf(file_config)<0) |
if (load_conf(file_config)<0) |
| 134 |
exit(-2); |
exit(-2); |
| 135 |
|
|
| 136 |
|
//Load menus |
| 137 |
|
strcpy(file_config, app_home_dir); |
| 138 |
|
strcat(file_config, "conf/main_menu.conf"); |
| 139 |
|
if (load_menu(&bbs_main_menu, file_config)<0) |
| 140 |
|
exit(-3); |
| 141 |
|
|
| 142 |
//Initialize socket server |
//Initialize socket server |
| 143 |
net_server(BBS_address, BBS_port); |
net_server(BBS_address, BBS_port); |
| 144 |
|
|