diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-08-17 18:27:28 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-08-17 18:27:28 +0000 |
commit | 606c667f37b2202517905fab0e585171d4bc76a7 (patch) | |
tree | 41db460ea7019988c333ebc10d30cd22b580f237 /libgps.c | |
parent | 2bdc358349945158f6b3f3a3194b2f5592055dec (diff) | |
download | gpsd-606c667f37b2202517905fab0e585171d4bc76a7.tar.gz |
Teach cgps to use Gary's function for deducing unit defaults.
Diffstat (limited to 'libgps.c')
-rw-r--r-- | libgps.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -14,7 +14,6 @@ extern char *strtok_r(char *, const char *, char **); #endif /* S_SPLINT_S */ -#ifdef __UNUSED__ /* * check the environment to determine proper GPS units * @@ -43,19 +42,19 @@ extern char *strtok_r(char *, const char *, char **); * * if none found then return compiled in default */ -int gpsd_units(void) +enum unit gpsd_units(void) { char *envu = NULL; if ((envu = getenv("GPSD_UNITS")) && *envu) { if (strcasecmp(envu, "imperial")) { - return 0; + return imperial; } if (strcasecmp(envu, "nautical")) { - return 1; + return nautical; } if (strcasecmp(envu, "metric")) { - return 2; + return metric; } /* unrecognized, ignore it */ } @@ -64,15 +63,14 @@ int gpsd_units(void) if ( strstr(envu, "_US") || strcasecmp(envu, "C") || strcasecmp(envu, "POSIX")) { - return 0; + return imperial; } /* Other, must be metric */ - return 2; + return metric; } /* TODO: allow a compile time default here */ - return 0; + return unspecified; } -#endif /* __UNUSED__ */ struct gps_data_t *gps_open(const char *host, const char *port) /* open a connection to a gpsd daemon */ |