summaryrefslogtreecommitdiff
path: root/xgps.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 /xgps.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 'xgps.c')
-rw-r--r--xgps.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/xgps.c b/xgps.c
index 1c66f251..9f24651c 100644
--- a/xgps.c
+++ b/xgps.c
@@ -1036,40 +1036,16 @@ get_resource(Widget w, char *name, char *default_value)
void
handle_gps(XtPointer client_data UNUSED, XtIntervalId *ignored UNUSED)
{
- char *err_str = NULL;
char error[128];
static bool dialog_posted = false;
/*@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;
- }
if (!gps_lost && !dialog_posted) {
(void)snprintf(error, sizeof(error),
"No GPS data available.\n\n%s\n\n"
"Check the connection to gpsd and if "
- "gpsd is running.", err_str);
+ "gpsd is running.", gps_errstr(errno));
(void)err_dialog(toplevel, error);
dialog_posted = true;
}