summaryrefslogtreecommitdiff
path: root/gpxlogger.c
diff options
context:
space:
mode:
authorMichael Tatarinov <kukabu@gmail.com>2013-11-01 09:03:49 +0400
committerEric S. Raymond <esr@thyrsus.com>2013-11-01 01:42:07 -0400
commit07b2ed972b39aec8bfb6fa80cf60cf0d11c8de59 (patch)
tree7253719664222546d82a99894ab4ea68990d9b78 /gpxlogger.c
parent2ae441d42411d416e9e3f39c60f6c14d23708f74 (diff)
downloadgpsd-07b2ed972b39aec8bfb6fa80cf60cf0d11c8de59.tar.gz
Fixed the choice of method in gpxlogger.
But at this point shm method is still broken. Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Diffstat (limited to 'gpxlogger.c')
-rw-r--r--gpxlogger.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gpxlogger.c b/gpxlogger.c
index a14427a7..b4875d5a 100644
--- a/gpxlogger.c
+++ b/gpxlogger.c
@@ -205,7 +205,8 @@ int main(int argc, char **argv)
progname = argv[0];
- if (export_default() == NULL) {
+ method = export_default();
+ if (method == NULL) {
(void)fprintf(stderr, "%s: no export methods.\n", progname);
exit(EXIT_FAILURE);
}
@@ -292,16 +293,20 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
- if (method != NULL)
- if (method->magic != NULL) {
- source.server = (char *)method->magic;
- source.port = NULL;
- }
+ if (method->magic != NULL) {
+ source.server = (char *)method->magic;
+ source.port = NULL;
+ source.device = NULL;
+ } else {
+ source.server = (char *)"localhost";
+ source.port = (char *)DEFAULT_GPSD_PORT;
+ source.device = NULL;
+ }
if (optind < argc) {
+ /* in this case, switch to the method "socket" always */
gpsd_source_spec(argv[optind], &source);
- } else
- gpsd_source_spec(NULL, &source);
+ }
#if 0
(void)fprintf(logfile,"<!-- server: %s port: %s device: %s -->\n",
source.server, source.port, source.device);