summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2004-09-29 22:16:24 +0000
committerEric S. Raymond <esr@thyrsus.com>2004-09-29 22:16:24 +0000
commit33713b972f6ac9f15e5326fb476bc0d02cfba4fd (patch)
tree0034f0ac1625d9c549daec4b6877cd60f8a80022
parent799032c5c1ff60593aa0f1438a5b29ef042352db (diff)
downloadgpsd-33713b972f6ac9f15e5326fb476bc0d02cfba4fd.tar.gz
Yet more cleanup and compaction.
-rw-r--r--gps.c13
-rw-r--r--libgps.c2
-rw-r--r--libgpsd_core.c1
-rw-r--r--netlib.c19
4 files changed, 9 insertions, 26 deletions
diff --git a/gps.c b/gps.c
index 32459d23..141864a4 100644
--- a/gps.c
+++ b/gps.c
@@ -38,7 +38,6 @@
#include <Xm/MenuShell.h>
#include <Xm/Protocols.h>
#include <X11/Shell.h>
-#include <sys/ioctl.h>
#ifdef HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif
@@ -47,8 +46,8 @@
extern void register_canvas(Widget w, GC gc);
extern void draw_graphics(struct gps_data_t *gpsdata);
+extern void redraw();
-/* global variables */
static Widget lxbApp, data_panel, satellite_list, satellite_diagram, status;
static Widget rowColumn_10, rowColumn_11, rowColumn_12, rowColumn_13;
static Widget rowColumn_14, rowColumn_15, rowColumn_16, rowColumn_17;
@@ -69,19 +68,15 @@ String fallback_resources[] =
NULL
};
-
-GC gc;
+static GC gc;
static Atom delw;
-extern void redraw();
-
static void quit_cb()
{
exit(0); /* closes the GPS along with other fds */
}
-Pixel
-get_pixel(Widget w, char *resource_value)
+static Pixel get_pixel(Widget w, char *resource_value)
{
Colormap colormap;
Boolean status;
@@ -261,7 +256,7 @@ static void build_gui(Widget lxbApp)
delw = XmInternAtom(XtDisplay(lxbApp), "WM_DELETE_WINDOW", False);
XmAddWMProtocolCallback(lxbApp, delw,
- (XtCallbackProc) quit_cb, (XtPointer) NULL);
+ (XtCallbackProc)quit_cb, (XtPointer)NULL);
}
void init_list()
diff --git a/libgps.c b/libgps.c
index 322f90f1..bf029a0b 100644
--- a/libgps.c
+++ b/libgps.c
@@ -232,8 +232,6 @@ int gps_query(struct gps_data_t *gpsdata, char *requests)
* A simple command-line exerciser for the library.
* Not meant to be installed in system directories,
* as it isn't really useful for anything but debugging.
- * Build with:
- * cc -o libgps -DTESTMAIN libgps.c .libs/libgps.a
*/
void data_dump(struct gps_data_t *collect, time_t now)
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 3ec15b43..8a38e8ff 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -4,7 +4,6 @@
*/
#include <unistd.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <sys/ioctl.h>
diff --git a/netlib.c b/netlib.c
index 19a21305..823f17ec 100644
--- a/netlib.c
+++ b/netlib.c
@@ -1,18 +1,11 @@
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
-
-#if defined (HAVE_STRINGS_H)
-#include <strings.h>
-#endif
-
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
-#include "config.h"
#include "gps.h"
#include "gpsd.h"
@@ -26,18 +19,16 @@ int netlib_connectsock(char *host, char *service, char *protocol)
struct servent *pse;
struct protoent *ppe;
struct sockaddr_in sin;
- int s, type;
- int one = 1;
+ int s, type, one = 1;
- bzero((char *) &sin, sizeof(sin));
+ memset((char *) &sin, '\0', sizeof(sin));
sin.sin_family = AF_INET;
-
- if ( (pse = getservbyname(service, protocol)) )
+ if ((pse = getservbyname(service, protocol)))
sin.sin_port = htons(ntohs((u_short) pse->s_port));
else if ((sin.sin_port = htons((u_short) atoi(service))) == 0)
return NL_NOSERVICE;
- if ( (phe = gethostbyname(host)) )
- bcopy(phe->h_addr, (char *) &sin.sin_addr, phe->h_length);
+ if ((phe = gethostbyname(host)))
+ memcpy((char *) &sin.sin_addr, phe->h_addr, phe->h_length);
else if ((sin.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE)
return NL_NOHOST;
if ((ppe = getprotobyname(protocol)) == 0)