summaryrefslogtreecommitdiff
path: root/libgps.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-08-17 18:27:28 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-08-17 18:27:28 +0000
commit606c667f37b2202517905fab0e585171d4bc76a7 (patch)
tree41db460ea7019988c333ebc10d30cd22b580f237 /libgps.c
parent2bdc358349945158f6b3f3a3194b2f5592055dec (diff)
downloadgpsd-606c667f37b2202517905fab0e585171d4bc76a7.tar.gz
Teach cgps to use Gary's function for deducing unit defaults.
Diffstat (limited to 'libgps.c')
-rw-r--r--libgps.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/libgps.c b/libgps.c
index 574ab9ed..691e344c 100644
--- a/libgps.c
+++ b/libgps.c
@@ -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 */