diff options
author | laforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2006-10-22 15:16:22 +0000 |
---|---|---|
committer | laforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2006-10-22 15:16:22 +0000 |
commit | 1d0806498974e90467535dee84926d295fe256d2 (patch) | |
tree | d761f7cd60f4fd64e373ff6ceb8aea17809eb8cd /src/gsmd/gsmd.c | |
parent | 4939b432c1dd37ef5cb6d21d7a8d7f570e6cad72 (diff) |
add logging infrastructure to gsm daemon
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@98 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/gsmd/gsmd.c')
-rw-r--r-- | src/gsmd/gsmd.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gsmd/gsmd.c b/src/gsmd/gsmd.c index 9267977..e6d9982 100644 --- a/src/gsmd/gsmd.c +++ b/src/gsmd/gsmd.c @@ -113,6 +113,7 @@ static struct option opts[] = { { "help", 0, NULL, 'h' }, { "device", 1, NULL, 'p' }, { "speed", 1, NULL, 's' }, + { "logfile", 1, NULL, 'l' }, }; static void print_help(void) @@ -125,6 +126,7 @@ static void print_help(void) "\t-h\t--help\t\tDisplay this help message\n" "\t-p dev\t--device dev\tSpecify serial device to be used\n" "\t-s spd\t--speed spd\tSpecify speed in bps (9600,38400,115200,...)\n" + "\t-l file\t--logfile file\tSpecify a logfile to log to\n" ); } @@ -135,9 +137,10 @@ int main(int argc, char **argv) int daemonize = 0; int bps = 115200; char *device = "/dev/ttyUSB0"; + char *logfile = "syslog"; /*FIXME: parse commandline, set daemonize, device, ... */ - while ((argch = getopt_long(argc, argv, "Vdhp:s:", opts, NULL)) != -1) { + while ((argch = getopt_long(argc, argv, "Vdhp:s:l:", opts, NULL)) != -1) { switch (argch) { case 'V': /* FIXME */ @@ -156,6 +159,12 @@ int main(int argc, char **argv) case 's': bps = atoi(optarg); break; + case 'l': + if (gsmdlog_init(optarg)) { + fprintf(stderr, "can't open logfile `%s'\n", optarg); + exit(2); + } + break; } } |