From 07b2ed972b39aec8bfb6fa80cf60cf0d11c8de59 Mon Sep 17 00:00:00 2001 From: Michael Tatarinov Date: Fri, 1 Nov 2013 09:03:49 +0400 Subject: Fixed the choice of method in gpxlogger. But at this point shm method is still broken. Signed-off-by: Eric S. Raymond --- gpxlogger.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'gpxlogger.c') 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,"\n", source.server, source.port, source.device); -- cgit v1.2.1