From 1d0806498974e90467535dee84926d295fe256d2 Mon Sep 17 00:00:00 2001 From: laforge Date: Sun, 22 Oct 2006 15:16:22 +0000 Subject: add logging infrastructure to gsm daemon git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@98 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/gsmd/gsmd.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/gsmd/gsmd.c') 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; } } -- cgit v1.2.3