--- lbbs/src/main.c 2025/06/17 01:24:21 1.52 +++ lbbs/src/main.c 2025/06/21 06:52:24 1.57 @@ -14,40 +14,39 @@ * * ***************************************************************************/ -#define _POSIX_C_SOURCE 200809L - #include "bbs.h" -#include "init.h" #include "common.h" -#include "net_server.h" -#include "log.h" +#include "file_loader.h" +#include "init.h" #include "io.h" +#include "log.h" #include "menu.h" -#include "file_loader.h" +#include "net_server.h" #include "section_list_loader.h" #include -#include +#include #include +#include +#include #include #include -#include -#include #include +#include -void app_help(void) +static void app_help(void) { - prints("Usage: bbsd [-fhv] [...]\n\n" - "-f\t--foreground\t\tForce program run in foreground\n" - "-h\t--help\t\t\tDisplay this help message\n" - "-v\t--version\t\tDisplay version information\n" - "\t--display-log\t\tDisplay standard log information\n" - "\t--display-error-log\tDisplay error log information\n" - "\n If meet any bug, please report to \n\n"); + fprintf(stderr, "Usage: bbsd [-fhv] [...]\n\n" + "-f\t--foreground\t\tForce program run in foreground\n" + "-h\t--help\t\t\tDisplay this help message\n" + "-v\t--version\t\tDisplay version information\n" + "\t--display-log\t\tDisplay standard log information\n" + "\t--display-error-log\tDisplay error log information\n" + "\n If meet any bug, please report to \n\n"); } -void arg_error(void) +static void arg_error(void) { - prints("Invalid arguments\n"); + fprintf(stderr, "Invalid arguments\n"); app_help(); } @@ -81,7 +80,7 @@ int main(int argc, char *argv[]) app_help(); return 0; case 'v': - puts(APP_NAME_VER); + puts(APP_INFO); return 0; default: arg_error(); @@ -103,7 +102,7 @@ int main(int argc, char *argv[]) } if (strcmp(argv[i] + 2, "version") == 0) { - puts(APP_NAME_VER); + puts(APP_INFO); return 0; } if (strcmp(argv[i] + 2, "display-log") == 0) @@ -147,7 +146,7 @@ int main(int argc, char *argv[]) log_error_redir(STDERR_FILENO); } - log_common("BBS Server (%s) is staring...\n", APP_NAME_VER); + log_common("Starting %s\n", APP_INFO); // Load configuration if (load_conf(CONF_BBSD) < 0) @@ -314,5 +313,7 @@ cleanup: log_common("Main process exit normally\n"); + log_end(); + return 0; }