summaryrefslogtreecommitdiff
path: root/cgps.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-08-26 23:49:31 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-08-26 23:49:31 +0000
commitb9cc68ba066757a71565fd29dd0e886a17bf2e21 (patch)
tree01d6463c81093c428f57f90d60d8f05791a6917d /cgps.c
parentf57255209c5b25c74e1fd5c84b6636bf76f02298 (diff)
downloadgpsd-b9cc68ba066757a71565fd29dd0e886a17bf2e21.tar.gz
Add gps_errstr() to the client API so client code doesn't have to
reinvent it all the time. Use it in gpsmon.
Diffstat (limited to 'cgps.c')
-rw-r--r--cgps.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/cgps.c b/cgps.c
index 96481707..92116949 100644
--- a/cgps.c
+++ b/cgps.c
@@ -754,18 +754,9 @@ int main(int argc, char *argv[])
/* Open the stream to gpsd. */
/*@i@*/gpsdata = gps_open(source.server, source.port);
if (!gpsdata) {
- switch ( errno ) {
- case NL_NOSERVICE: err_str = "can't get service entry"; break;
- case NL_NOHOST: err_str = "can't get host entry"; break;
- case NL_NOPROTO: err_str = "can't get protocol entry"; break;
- case NL_NOSOCK: err_str = "can't create socket"; break;
- case NL_NOSOCKOPT: err_str = "error SETSOCKOPT SO_REUSEADDR"; break;
- case NL_NOCONNECT: err_str = "can't connect to host"; break;
- default: err_str = "Unknown"; break;
- }
(void)fprintf( stderr,
"cgps: no gpsd running or network error: %d, %s\n",
- errno, err_str);
+ errno, netlib_errstr(errno));
exit(2);
}