--- lbbs/src/main.c 2004/10/18 08:16:18 1.1 +++ lbbs/src/main.c 2005/03/19 08:23:05 1.10 @@ -1,5 +1,5 @@ /*************************************************************************** - bbsd.c - description + main.c - description ------------------- begin : Mon Oct 11 2004 copyright : (C) 2004 by Leaflet @@ -15,26 +15,134 @@ * * ***************************************************************************/ +#include "bbs.h" #include "common.h" +#include "io.h" +#include "menu.h" +#include + +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" + ); +} + +void +arg_error(void) +{ + prints ("Invalid arguments\n"); + app_help(); +} int main (int argc, char *argv[]) { - FILE *fp; - time_t t; + char log_dir[256], file_log_std[256], file_log_error[256], file_config[256]; + int i,j; + int daemon = 1, std_log_redir = 0, error_log_redir = 0; - init_daemon (); - - while (1) + //Parse args + for (i=1; i= 0) - { - t = time (0); - fprintf (fp, "I'm here at %s\n", asctime (localtime (&t))); - fclose (fp); - } + switch (argv[i][0]) + { + case '-': + if (argv[i][1] != '-') + { + for (j=1; j