summaryrefslogtreecommitdiff
path: root/gpsdclient.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-01-13 02:48:06 +0000
committerEric S. Raymond <esr@thyrsus.com>2010-01-13 02:48:06 +0000
commit19178965f484ddc11eabf098ba4d436a5d7c684d (patch)
tree8d792367b6f76c86274fae66c6d3a05aa13580bb /gpsdclient.c
parent28744833f7d899bdb110de593a3bfed003a503b7 (diff)
downloadgpsd-19178965f484ddc11eabf098ba4d436a5d7c684d.tar.gz
Improved client argument parsing to recognize IPv6 addresses...
...and do the right thing with suffixes. Teach the client library to connect using IPv6 when appropriate.
Diffstat (limited to 'gpsdclient.c')
-rw-r--r--gpsdclient.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gpsdclient.c b/gpsdclient.c
index 1befefd1..77d276a6 100644
--- a/gpsdclient.c
+++ b/gpsdclient.c
@@ -137,11 +137,17 @@ void gpsd_source_spec(const char *arg, struct fixsource_t *source)
source->port = DEFAULT_GPSD_PORT;
source->device = NULL;
+ /*@-usedef@ Sigh, splint is buggy*/
if (arg != NULL) {
- char *colon1;
+ char *colon1, *skipto, *rbrk;
source->spec = strdup(arg);
assert(source->spec != NULL);
- colon1 = strchr(source->spec, ':');
+
+ skipto = source->spec;
+ if (*skipto == '[' && (rbrk = strchr(skipto, ']'))!=NULL) {
+ skipto = rbrk;
+ }
+ colon1 = strchr(skipto, ':');
if (colon1 != NULL) {
char *colon2;
@@ -160,6 +166,7 @@ void gpsd_source_spec(const char *arg, struct fixsource_t *source)
source->server = source->spec;
}
}
+ /*@+usedef@*/
}
/*@ +observertrans -statictrans +mustfreeonly +branchstate +kepttrans @*/