diff options
author | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-11 19:10:26 +0800 |
---|---|---|
committer | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-11 19:10:26 +0800 |
commit | e1bfbc6f3de9813347cf8f9c27d303ddb0cb0d58 (patch) | |
tree | 8fd892bad9559fc9b92ef9b41b60c5cf29b0fdc7 | |
parent | 65bb87136a9d4ec974d956550dcb2c1fdc61e92c (diff) | |
download | pttbbs-e1bfbc6f3de9813347cf8f9c27d303ddb0cb0d58.tar pttbbs-e1bfbc6f3de9813347cf8f9c27d303ddb0cb0d58.tar.gz pttbbs-e1bfbc6f3de9813347cf8f9c27d303ddb0cb0d58.tar.bz2 pttbbs-e1bfbc6f3de9813347cf8f9c27d303ddb0cb0d58.tar.lz pttbbs-e1bfbc6f3de9813347cf8f9c27d303ddb0cb0d58.tar.xz pttbbs-e1bfbc6f3de9813347cf8f9c27d303ddb0cb0d58.tar.zst pttbbs-e1bfbc6f3de9813347cf8f9c27d303ddb0cb0d58.zip |
Add argument for log output
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4563 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | daemon/logind/logind.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/daemon/logind/logind.c b/daemon/logind/logind.c index c66c6daf..6f159fb5 100644 --- a/daemon/logind/logind.c +++ b/daemon/logind/logind.c @@ -1303,16 +1303,20 @@ main(int argc, char *argv[]) FILE *fp; char tunnel_path[PATHLEN] = ""; const char *config_file = FN_CONF_BINDPORTS; + const char *log_file = NULL; Signal(SIGPIPE, SIG_IGN); - while ( (ch = getopt(argc, argv, "f:p:t:hDv")) != -1 ) + while ( (ch = getopt(argc, argv, "f:p:t:l:hDv")) != -1 ) { switch( ch ){ case 'f': config_file = optarg; break; + case 'l': + log_file = optarg; + break; case 'p': if (optarg) port = atoi(optarg); break; @@ -1327,7 +1331,7 @@ main(int argc, char *argv[]) break; case 'h': default: - fprintf(stderr, "usage: %s [-v][-D] [-f bindport_conf] [-p port] [-t tunnel_path]\r\n", argv[0]); + fprintf(stderr, "usage: %s [-v][-D] [-l log_file] [-f bindport_conf] [-p port] [-t tunnel_path]\r\n", argv[0]); fprintf(stderr, "\t-f: read configuration from file (default: %s)\r\n", BBSHOME "/" FN_CONF_BINDPORTS); fprintf(stderr, "\t-v: provide verbose messages\r\n"); fprintf(stderr, "\t-D: do not enter daemon mode.\r\n"); @@ -1392,8 +1396,7 @@ main(int argc, char *argv[]) if (as_daemon) { fprintf(stderr, LOG_PREFIX "start daemonize\r\n"); - //daemonize(BBSHOME "/run/logind.pid", BBSHOME "/log/logind.err"); - daemonize(BBSHOME "/run/logind.pid", "/dev/fd/2"); + daemonize(BBSHOME "/run/logind.pid", log_file); } // Some event notification mechanisms don't work across forks (e.g. kqueue) |