summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2004-09-30 10:46:21 +0000
committerEric S. Raymond <esr@thyrsus.com>2004-09-30 10:46:21 +0000
commitdfda2ce85b340dd25e9082c6f49f3bcfabbccf0f (patch)
treee683fca296007b028c807aaabdbf290a54b9e610
parent709fc6b6d53ceb5855e78dbd678056ac1ad2dc97 (diff)
downloadgpsd-dfda2ce85b340dd25e9082c6f49f3bcfabbccf0f.tar.gz
-p option is now optional arg.
-rw-r--r--gps.c23
-rw-r--r--gpsd.spec.in5
-rw-r--r--gpsd.xml30
-rw-r--r--xgpsspeed.c24
4 files changed, 35 insertions, 47 deletions
diff --git a/gps.c b/gps.c
index 3049bb6b..e0d31f4f 100644
--- a/gps.c
+++ b/gps.c
@@ -388,33 +388,32 @@ static void handle_alarm(int sig)
int main(int argc, char *argv[])
{
XtAppContext app;
- extern char *optarg;
int option;
char *colon, *server = NULL;
char *port = DEFAULT_GPSD_PORT;
- while ((option = getopt(argc, argv, "hp:")) != -1) {
+ while ((option = getopt(argc, argv, "h")) != -1) {
switch (option) {
- case 'p':
- server = strdup(optarg);
- colon = strchr(server, ':');
- if (colon != NULL) {
- server[colon - server] = '\0';
- port = colon + 1;
- }
- break;
case 'h':
case '?':
default:
- fputs("usage: gps [options] \n\
+ fputs("usage: gps [-h] [server[:port]] \n\
options include: \n\
- -p string = set server:port to query \n\
-h = help message \n\
", stderr);
exit(1);
}
}
+ if (optind < argc)
+ {
+ server = strdup(argv[optind]);
+ colon = strchr(server, ':');
+ if (colon != NULL) {
+ server[colon - server] = '\0';
+ port = colon + 1;
+ }
+ }
/*
* Essentially all the interface to libgps happens below here
*/
diff --git a/gpsd.spec.in b/gpsd.spec.in
index 5ff776a4..bb330edf 100644
--- a/gpsd.spec.in
+++ b/gpsd.spec.in
@@ -117,13 +117,14 @@ cp xgpsspeed.ad "$RPM_BUILD_ROOT"%{_libdir}/X11/app-defaults/xgpsspeed
%{_libdir}/python*/site-packages/gpsd.py
%changelog
-* Tue Sep 28 2004 Eric S. Raymond <esr@snark.thyrsus.com> - 2.1-1
+* Thu Sep 30 2004 Eric S. Raymond <esr@snark.thyrsus.com> - 2.1-1
- Various internal cleanups, including fossil removal in the
configuration machinery. FV-18, Tripmate, Earthmate and are now
enabled but can be disable with --disable-$NAME at configure time.
When you call configure with --disable-shared, libgps is linked
statically to the binaries (native libs are still linked
- shared). Fixed buggy handling of -p option in gps.c and xgpsspeed.c.
+ shared). Fixed buggy handling of -p option in gps.c and xgpsspeed.c;
+ it's now an optional command-line argument.
* Thu Sep 16 2004 Eric S. Raymond <esr@snark.thyrsus.com> - 2.0-1
- Packaging fixes for 2.0 release.
diff --git a/gpsd.xml b/gpsd.xml
index 4fc850bb..de6583a1 100644
--- a/gpsd.xml
+++ b/gpsd.xml
@@ -32,14 +32,14 @@ and speedometer</refpurpose>
<cmdsynopsis>
<command>gps</command>
<arg choice='opt'><replaceable>X-options</replaceable></arg>
- <arg choice='opt'>-p <replaceable>server:port</replaceable></arg>
<arg choice='opt'>-h </arg>
+ <arg choice='opt'><replaceable>server</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>xgpsspeed</command>
<arg choice='opt'><replaceable>X-options</replaceable></arg>
- <arg choice='opt'>-p <replaceable>server:port</replaceable></arg>
<arg choice='opt'>-h </arg>
+ <arg choice='opt'><replaceable>server</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -240,18 +240,6 @@ decibels, and 1 or 0 according as the satellite was or was
not used in the last fix. Each number is followed by one space.</para>
</listitem>
</varlistentry>
-
-<!--
-<varlistentry>
-<term>z</term>
-<listitem>
-<para>Returns Z= followed by a count not more than 12, followed by that many
-pairs of satellite PRNs and signal-to-noise percentages (each
-percentage is in the range 0-99). Each number is an integer formatted as
-%d followed by one space.</para>
-</listitem>
-</varlistentry>
--->
</variablelist>
<para>Note that a response consisting of just ? following the =
@@ -302,18 +290,18 @@ pulling down DTR.</para>
displays current GPS animation and (for GPSes that support the
feature) the locations of accessible satellites.</para>
-<para>gps accepts an -h option as for gpsd. With the -p option you
-may specify an alternate server:port to get data from. The misfeature of
-previous version that allowed it to direct-connect to the serial device has
-been removed.</para>
+<para>gps accepts an -h option as for gpsd. An optional argument may
+specify an server to get data from; a colon-separated suffix is taken
+as a port number. The misfeature of previous versions that allowed it
+to direct-connect to the serial device has been removed.</para>
</refsect2>
<refsect2><title>xgpsspeed</title>
<para>xgpsspeed is a speedometer that uses position information from
-the GPS. It accepts -ph options as for xgps. The misfeature of
-previous version that allowed it to direct-connect to the serial device has
-been removed.</para>
+the GPS. It accepts an -h option and optional argument as for gps. The
+misfeature of previous version that allowed it to direct-connect to
+the serial device has been removed.</para>
</refsect2>
</refsect1>
diff --git a/xgpsspeed.c b/xgpsspeed.c
index 81f3c094..5a911e22 100644
--- a/xgpsspeed.c
+++ b/xgpsspeed.c
@@ -58,33 +58,33 @@ int main(int argc, char **argv)
Arg args[10];
XtAppContext app;
Cardinal i;
- extern char *optarg;
int option;
char *colon, *server = NULL;
char *port = DEFAULT_GPSD_PORT;
- while ((option = getopt(argc, argv, "hp:")) != -1) {
+ while ((option = getopt(argc, argv, "h")) != -1) {
switch (option) {
- case 'p':
- server = strdup(optarg);
- colon = strchr(server, ':');
- if (colon != NULL) {
- server[colon - server] = '\0';
- port = colon + 1;
- }
- break;
case 'h':
case '?':
default:
- fputs("usage: gps [options] \n\
+ fputs("usage: gps [-h] [server[:port]]\n\
options include: \n\
- -p string = set GPS device name \n\
-h = help message \n\
", stderr);
exit(1);
}
}
+ if (optind < argc)
+ {
+ server = strdup(argv[optind]);
+ colon = strchr(server, ':');
+ if (colon != NULL) {
+ server[colon - server] = '\0';
+ port = colon + 1;
+ }
+ }
+
toplevel = XtVaAppInitialize(&app, "xpsspeed.ad",
options, XtNumber(options),
&argc, argv, fallback_resources, NULL);