diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-08-26 23:49:31 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-08-26 23:49:31 +0000 |
commit | b9cc68ba066757a71565fd29dd0e886a17bf2e21 (patch) | |
tree | 01d6463c81093c428f57f90d60d8f05791a6917d /netlib.c | |
parent | f57255209c5b25c74e1fd5c84b6636bf76f02298 (diff) | |
download | gpsd-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 'netlib.c')
-rw-r--r-- | netlib.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -87,6 +87,19 @@ int netlib_connectsock(const char *host, const char *service, const char *protoc /*@ +type +mustfreefresh @*/ } +char /*@observer@*/ *netlib_errstr(const int err) +{ + switch (err) { + case NL_NOSERVICE: return "can't get service entry"; break; + case NL_NOHOST: return "can't get host entry"; break; + case NL_NOPROTO: return "can't get protocol entry"; break; + case NL_NOSOCK: return "can't create socket"; break; + case NL_NOSOCKOPT: return "error SETSOCKOPT SO_REUSEADDR"; break; + case NL_NOCONNECT: return "can't connect to host/port pair"; break; + default: return "unknown error"; break; + } +} + char *sock2ip(int fd) { struct sockaddr fsin; |