From 1ac6060e10451ba404a7ffff60d1670569b5c090 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 20 Feb 2009 15:02:04 +0000 Subject: Implement -l option analogous to gpsctl -l. --- gpsmon.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'gpsmon.c') diff --git a/gpsmon.c b/gpsmon.c index d36d0ca8..94ccda8f 100644 --- a/gpsmon.c +++ b/gpsmon.c @@ -340,7 +340,7 @@ int main (int argc, char **argv) gmt_offset = (int)tzoffset(); /*@ -branchstate @*/ - while ((option = getopt(argc, argv, "D:F:Vh")) != -1) { + while ((option = getopt(argc, argv, "D:F:Vhl")) != -1) { switch (option) { case 'D': debuglevel = atoi(optarg); @@ -351,6 +351,28 @@ int main (int argc, char **argv) case 'V': (void)printf("gpsmon %s\n", VERSION); exit(0); + case 'l': /* list known device types */ + for (active = monitor_objects; *active; active++) { + (void)fputs((*active)->driver->type_name, stdout); + (void)fputs("\ti l", stdout); + (void)fputc(' ', stdout); + if ((*active)->driver->mode_switcher != NULL) + (void)fputc('n', stdout); + else + (void)fputc(' ', stdout); + (void)fputc(' ', stdout); + if ((*active)->driver->speed_switcher != NULL) + (void)fputc('s', stdout); + else + (void)fputc(' ', stdout); + (void)fputc(' ', stdout); + if ((*active)->driver->control_send != NULL) + (void)fputc('c', stdout); + else + (void)fputc(' ', stdout); + (void)fputc('\n', stdout); + } + exit(0); case 'h': case '?': default: (void)fputs("usage: gpsmon [-?hv] [-F controlsock] [server[:port:[device]]]\n", stderr); exit(1); -- cgit v1.2.1