diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-03-27 12:03:00 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-03-27 12:03:00 -0400 |
commit | 1f5816e6fd4ea335fefff8b4d40872724fb415fa (patch) | |
tree | 5851f82df5ac578ba641d998a75ccc757b3df01e /gpsmon.c | |
parent | daf2e8b8bad74f350406eea4c9939654926d6c39 (diff) | |
download | gpsd-1f5816e6fd4ea335fefff8b4d40872724fb415fa.tar.gz |
Change the -l option of gpsmon so it enable logging at srartup.
The old -l option (list types) becomes -L. We did this so the 'l' option
will be consistent with the 'l' command. Should be OK since gpsmon is
not something anyone will use in a script.
Diffstat (limited to 'gpsmon.c')
-rw-r--r-- | gpsmon.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -414,7 +414,7 @@ int main (int argc, char **argv) (void)putenv("TZ=GMT"); // for ctime() /*@ +observertrans @*/ /*@ -branchstate @*/ - while ((option = getopt(argc, argv, "D:F:Vhl")) != -1) { + while ((option = getopt(argc, argv, "D:F:LVhl:")) != -1) { switch (option) { case 'D': debuglevel = atoi(optarg); @@ -425,7 +425,7 @@ int main (int argc, char **argv) case 'V': (void)printf("gpsmon: %s (revision %s)\n", VERSION, REVISION); exit(0); - case 'l': /* list known device types */ + case 'L': /* list known device types */ (void) fputs("General commands available per type. '+' means there are private commands.\n", stdout); for (active = monitor_objects; *active; active++) { (void)fputs("i l q ^S ^Q", stdout); @@ -463,6 +463,13 @@ int main (int argc, char **argv) (void)fputc('\n', stdout); } exit(0); + case 'l': /* enable logging at startup */ + logfile = fopen(optarg, "w"); + if (logfile == NULL) { + (void)fprintf(stderr, "Couldn't open logfile for writing.\n"); + exit(1); + } + break; case 'h': case '?': default: (void)fputs("usage: gpsmon [-?hVl] [-D debuglevel] [-F controlsock] [server[:port:[device]]]\n", stderr); exit(1); |