summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2004-10-04 16:54:41 +0000
committerEric S. Raymond <esr@thyrsus.com>2004-10-04 16:54:41 +0000
commitf3f32e2505438f236dfdc696f0124c787bc01f33 (patch)
tree39df880c2824001a2f70474cb3bd2e644174dcc1
parent84f3f4ded2c8a594f49d661f8293405bf5af5fba (diff)
downloadgpsd-f3f32e2505438f236dfdc696f0124c787bc01f33.tar.gz
BSD port fixes and more code cleanup.
-rw-r--r--Tachometer.c6
-rw-r--r--Tachometer.h7
-rw-r--r--TachometerP.h33
-rw-r--r--display.c28
-rw-r--r--drivers.c1
-rw-r--r--gps.c38
-rw-r--r--gpsd.c66
-rw-r--r--gpsd.h1
-rw-r--r--gpsd.spec.in2
-rw-r--r--libgps.c43
-rw-r--r--libgpsd_core.c11
-rw-r--r--netlib.c1
-rw-r--r--nmea_parse.c10
-rw-r--r--serial.c17
-rw-r--r--xgpsspeed.c7
-rw-r--r--zodiac.c7
16 files changed, 74 insertions, 204 deletions
diff --git a/Tachometer.c b/Tachometer.c
index 47771f67..c4d17557 100644
--- a/Tachometer.c
+++ b/Tachometer.c
@@ -528,11 +528,8 @@ static void Realize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
(*superclass->core_class.realize) (w, valueMask, attributes);
} /* Realize */
-/*
- * Repaint the widget window
- */
-
static void Redisplay(Widget w, XEvent *event, Region region)
+/* Repaint the widget window */
{
TachometerWidget ta = (TachometerWidget) w;
@@ -596,7 +593,6 @@ static Boolean SetValues(Widget current, Widget request, Widget new)
GetbackgroundGC(newta);
changed = True;
}
-
if (curta->tachometer.value != newta->tachometer.value) {
MoveNeedle(newta, newta->tachometer.value);
changed = True;
diff --git a/Tachometer.h b/Tachometer.h
index 296f8cc6..312fb283 100644
--- a/Tachometer.h
+++ b/Tachometer.h
@@ -1,12 +1,7 @@
+/* Tachometer.h -- tachometer widget interface */
#ifndef _Tachometer_h
#define _Tachometer_h
-/***********************************************************************
- *
- * Tachometer Widget
- *
- ***********************************************************************/
-
#include <X11/Xaw/Simple.h>
/* Resources:
diff --git a/TachometerP.h b/TachometerP.h
index 50a4a62a..1238ab03 100644
--- a/TachometerP.h
+++ b/TachometerP.h
@@ -1,17 +1,11 @@
+/* TachometerP.h -- Tachometer widget private data */
#ifndef _TachometerP_h
#define _TachometerP_h
-/***********************************************************************
- *
- * Tachometer Widget Private Data
- *
- ***********************************************************************/
-
#include <Tachometer.h>
#include <X11/Xaw/SimpleP.h>
/* New fields for the Tachometer widget class record */
-
typedef struct {int foo;} TachometerClassPart;
/* Full class record declaration */
@@ -26,32 +20,17 @@ extern TachometerClassRec tachometerClassRec;
/* New fields for the Tachometer widget record */
typedef struct {
/* resources */
- Pixel needle;
- Pixel scale;
- Pixel circle;
- int value;
- int speed;
-
+ Pixel needle, scale, circle;
+ int value, speed;
/* private state */
- GC needle_GC;
- GC scale_GC;
- GC circle_GC;
- GC background_GC;
+ GC needle_GC, scale_GC, circle_GC, background_GC;
/* We need to store the width and height separately, because when */
/* we get a resize request, we need to know if the window has */
/* gotten bigger. */
- Dimension width;
- Dimension height;
- Dimension internal_border;
+ Dimension width, height, internal_border;
} TachometerPart;
-
-/****************************************************************
- *
- * Full instance record declaration
- *
- ****************************************************************/
-
+/* Full instance record declaration */
typedef struct _TachometerRec {
CorePart core;
SimplePart simple;
diff --git a/display.c b/display.c
index 44da878f..da174b1a 100644
--- a/display.c
+++ b/display.c
@@ -4,9 +4,6 @@
#include "gps.h"
-extern void register_canvas(Widget w, GC gc);
-extern void draw_graphics(struct gps_data_t *gpsdata);
-
#define XCENTER (double)(width/2)
#define YCENTER (double)(height/2)
#define SCALE (double)(diameter/2)
@@ -85,7 +82,7 @@ static int get_status(struct gps_data_t *gpsdata, int satellite)
{
int i, s;
- for (i = 0; i < 12; i++)
+ for (i = 0; i < MAXCHANNELS; i++)
if (satellite == gpsdata->PRN[i]) {
s = gpsdata->ss[i];
@@ -104,7 +101,6 @@ void draw_graphics(struct gps_data_t *gpsdata)
char buf[20];
if (SEEN(gpsdata->satellite_stamp)) {
-
i = min(width, height);
set_color("White");
@@ -126,37 +122,29 @@ void draw_graphics(struct gps_data_t *gpsdata)
pol2cart(0, 0, &x, &y);
set_color("Black");
- XDrawString(XtDisplay(draww), pixmap, drawGC,
- (int) x, (int) y, "N", 1);
+ XDrawString(XtDisplay(draww),pixmap, drawGC, (int)x, (int)y, "N", 1);
pol2cart(90, 0, &x, &y);
set_color("Black");
- XDrawString(XtDisplay(draww), pixmap, drawGC,
- (int) x+2, (int) y, "E", 1);
+ XDrawString(XtDisplay(draww),pixmap, drawGC, (int)x+2, (int)y, "E", 1);
pol2cart(180, 0, &x, &y);
set_color("Black");
- XDrawString(XtDisplay(draww), pixmap, drawGC,
- (int) x, (int) y+10, "S", 1);
+ XDrawString(XtDisplay(draww),pixmap, drawGC, (int)x, (int)y+10, "S", 1);
pol2cart(270, 0, &x, &y);
set_color("Black");
- XDrawString(XtDisplay(draww), pixmap, drawGC,
- (int) x-5, (int) y, "W", 1);
+ XDrawString(XtDisplay(draww),pixmap, drawGC, (int) x-5,(int)y, "W", 1);
/* Now draw the satellites... */
for (i = 0; i < gpsdata->satellites; i++) {
pol2cart(gpsdata->azimuth[i], gpsdata->elevation[i], &x, &y);
switch (get_status(gpsdata, gpsdata->PRN[i]) & 7) {
- case 0:
- case 1:
+ case 0: case 1:
set_color("Grey");
break;
- case 2:
- case 3:
+ case 2: case 3:
set_color("Yellow");
break;
- case 4:
- case 5:
- case 6:
+ case 4: case 5: case 6:
set_color("Red");
break;
case 7:
diff --git a/drivers.c b/drivers.c
index 36d3f681..7cf8e320 100644
--- a/drivers.c
+++ b/drivers.c
@@ -3,7 +3,6 @@
#include <unistd.h>
#include <string.h>
-#include "gps.h"
#include "gpsd.h"
/**************************************************************************
diff --git a/gps.c b/gps.c
index e01ed46d..2616c6f2 100644
--- a/gps.c
+++ b/gps.c
@@ -1,21 +1,9 @@
-
-/* include files */
-#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
-
-#if defined (HAVE_SYS_TERMIOS_H)
-#include <sys/termios.h>
-#else
-#if defined (HAVE_TERMIOS_H)
-#include <termios.h>
-#endif
-#endif
-
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/ScrolledW.h>
@@ -38,9 +26,6 @@
#include <Xm/MenuShell.h>
#include <Xm/Protocols.h>
#include <X11/Shell.h>
-#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h>
-#endif
#include "gps.h"
@@ -55,8 +40,7 @@ static Widget rowColumn_18, pushButton_11;
static Widget text_1, text_2, text_3, text_4, text_5, text_6, text_7;
static Widget label_1, label_2, label_3, label_4, label_5, label_6, label_7;
-String fallback_resources[] =
-{
+String fallback_resources[] = {
"*gpsdata.time.label.labelString: Time ",
"*gpsdata.latitude.label.labelString: Lat. ",
"*gpsdata.longitude.label.labelString: Long. ",
@@ -329,13 +313,10 @@ static void update_panel(char *message)
sprintf(s, "%f", gpsdata->track);
XmTextFieldSetString(text_6, s);
- if (!gpsdata->online)
- {
+ if (!gpsdata->online) {
newstate = 0;
sprintf(s, "OFFLINE");
- }
- else
- {
+ } else {
newstate = gpsdata->mode;
switch (gpsdata->mode) {
case 2:
@@ -349,8 +330,7 @@ static void update_panel(char *message)
break;
}
}
- if (newstate != state)
- {
+ if (newstate != state) {
timer = 0;
state = newstate;
}
@@ -397,14 +377,10 @@ int main(int argc, char *argv[])
case 'h':
case '?':
default:
- fputs("usage: gps [-h] [server[:port]] \n\
- options include: \n\
- -h = help message \n\
-", stderr);
+ fputs("usage: gps [-h] [server[:port]]\n", stderr);
exit(1);
}
}
-
if (optind < argc) {
server = strdup(argv[optind]);
colon = strchr(server, ':');
@@ -413,9 +389,7 @@ int main(int argc, char *argv[])
port = colon + 1;
}
}
- /*
- * Essentially all the interface to libgps happens below here
- */
+
gpsdata = gps_open(server, port);
if (!gpsdata) {
fprintf(stderr, "gps: no gpsd running or network error (%d).\n", errno);
diff --git a/gpsd.c b/gpsd.c
index c668b8e8..f13514da 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -27,7 +27,6 @@
#include <sys/time.h>
#endif
-#include "gps.h"
#include "gpsd.h"
#define QLEN 5
@@ -219,33 +218,28 @@ static int handle_request(int fd, char *buf, int buflen)
strcat(reply, ",A=?");
else
sprintf(reply + strlen(reply),
- ",A=%f",
- session->gNMEAdata.altitude);
+ ",A=%f", session->gNMEAdata.altitude);
break;
case 'D':
if (session->gNMEAdata.utc[0])
sprintf(reply + strlen(reply),
- ",D=%s",
- session->gNMEAdata.utc);
+ ",D=%s", session->gNMEAdata.utc);
else
strcat(reply, ",D=?");
break;
case 'L':
- sprintf(reply + strlen(reply),
- ",l=1 " VERSION " admpqrstvwxy");
+ sprintf(reply + strlen(reply), ",l=1 " VERSION " admpqrstvwxy");
break;
case 'M':
sprintf(reply + strlen(reply),
- ",M=%d",
- session->gNMEAdata.mode);
+ ",M=%d", session->gNMEAdata.mode);
break;
case 'P':
if (!validate(fd))
strcat(reply, ",P=?");
else
sprintf(reply + strlen(reply),
- ",P=%f %f",
- session->gNMEAdata.latitude,
+ ",P=%f %f", session->gNMEAdata.latitude,
session->gNMEAdata.longitude);
break;
case 'Q':
@@ -261,71 +255,59 @@ static int handle_request(int fd, char *buf, int buflen)
if (*p == '1' || *p == '+') {
FD_SET(fd, &nmea_fds);
gpsd_report(3, "%d turned on raw mode\n", fd);
- sprintf(reply + strlen(reply),
- ",R=1");
+ sprintf(reply + strlen(reply), ",R=1");
p++;
} else if (*p == '0' || *p == '-') {
FD_CLR(fd, &nmea_fds);
gpsd_report(3, "%d turned off raw mode\n", fd);
- sprintf(reply + strlen(reply),
- ",R=0");
+ sprintf(reply + strlen(reply), ",R=0");
p++;
} else if (FD_ISSET(fd, &nmea_fds)) {
FD_CLR(fd, &nmea_fds);
gpsd_report(3, "%d turned off raw mode\n", fd);
- sprintf(reply + strlen(reply),
- ",R=0");
+ sprintf(reply + strlen(reply), ",R=0");
} else {
FD_SET(fd, &nmea_fds);
gpsd_report(3, "%d turned on raw mode\n", fd);
- sprintf(reply + strlen(reply),
- ",R=1");
+ sprintf(reply + strlen(reply), ",R=1");
}
break;
case 'S':
- sprintf(reply + strlen(reply),
- ",S=%d",
- session->gNMEAdata.status);
+ sprintf(reply + strlen(reply), ",S=%d", session->gNMEAdata.status);
break;
case 'T':
if (!validate(fd))
strcat(reply, ",T=?");
else
sprintf(reply + strlen(reply),
- ",T=%f",
- session->gNMEAdata.track);
+ ",T=%f", session->gNMEAdata.track);
break;
case 'V':
if (!validate(fd))
strcat(reply, ",V=?");
else
sprintf(reply + strlen(reply),
- ",V=%f",
- session->gNMEAdata.speed);
+ ",V=%f", session->gNMEAdata.speed);
break;
case 'W':
if (*p == '1' || *p == '+') {
FD_SET(fd, &watcher_fds);
gpsd_report(3, "%d turned on watching\n", fd);
- sprintf(reply + strlen(reply),
- ",W=1");
+ sprintf(reply + strlen(reply), ",W=1");
p++;
} else if (*p == '0' || *p == '-') {
FD_CLR(fd, &watcher_fds);
gpsd_report(3, "%d turned off watching\n", fd);
- sprintf(reply + strlen(reply),
- ",W=0");
+ sprintf(reply + strlen(reply), ",W=0");
p++;
} else if (FD_ISSET(fd, &watcher_fds)) {
FD_CLR(fd, &watcher_fds);
gpsd_report(3, "%d turned off watching\n", fd);
- sprintf(reply + strlen(reply),
- ",W=0");
+ sprintf(reply + strlen(reply), ",W=0");
} else {
FD_SET(fd, &watcher_fds);
gpsd_report(3, "%d turned on watching\n", fd);
- sprintf(reply + strlen(reply),
- ",W=1");
+ sprintf(reply + strlen(reply), ",W=1");
}
break;
case 'X':
@@ -345,8 +327,7 @@ static int handle_request(int fd, char *buf, int buflen)
for (i = 0; i < session->gNMEAdata.satellites; i++) {
used = 0;
for (j = 0; j < session->gNMEAdata.satellites_used; j++)
- if (session->gNMEAdata.used[j] == session->gNMEAdata.PRN[i])
- {
+ if (session->gNMEAdata.used[j] == session->gNMEAdata.PRN[i]) {
used = 1;
break;
}
@@ -422,8 +403,7 @@ static int passivesock(char *service, char *protocol, int qlen)
struct servent *pse;
struct protoent *ppe;
struct sockaddr_in sin;
- int s, type;
- int one = 1;
+ int s, type, one = 1;
memset((char *) &sin, '\0', sizeof(sin));
sin.sin_family = AF_INET;
@@ -594,9 +574,7 @@ int main(int argc, char *argv[])
gpsd_report(1, "gpsd restarted by SIGHUP\n");
}
- FD_ZERO(&all_fds);
- FD_ZERO(&nmea_fds);
- FD_ZERO(&watcher_fds);
+ FD_ZERO(&all_fds); FD_ZERO(&nmea_fds); FD_ZERO(&watcher_fds);
FD_SET(msock, &all_fds);
nfds = getdtablesize();
@@ -627,8 +605,7 @@ int main(int argc, char *argv[])
* update once a second. Nyquist's theorem tells us that it
* is optimal to sample at twice this frequency.
*/
- tv.tv_sec = 0;
- tv.tv_usec = 500000;
+ tv.tv_sec = 0; tv.tv_usec = 500000;
if (select(nfds, &rfds, NULL, NULL, &tv) < 0) {
if (errno == EINTR)
continue;
@@ -657,8 +634,7 @@ int main(int argc, char *argv[])
/* we may need to force the GPS open */
if (nowait && session->gNMEAdata.gps_fd == -1) {
gpsd_deactivate(session);
- if (gpsd_activate(session) >= 0)
- {
+ if (gpsd_activate(session) >= 0) {
notify_watchers("GPSD,X=1\r\n");
FD_SET(session->gNMEAdata.gps_fd, &all_fds);
}
diff --git a/gpsd.h b/gpsd.h
index 2c7bc31e..43d32727 100644
--- a/gpsd.h
+++ b/gpsd.h
@@ -1,5 +1,6 @@
/* gpsd.h -- fundamental types and structures for the GPS daemon */
+#include "gps.h"
/*
* Some internal capabilities depend on which drivers we're compiling.
*/
diff --git a/gpsd.spec.in b/gpsd.spec.in
index be3d42cb..2d2ad87d 100644
--- a/gpsd.spec.in
+++ b/gpsd.spec.in
@@ -118,7 +118,7 @@ cp xgpsspeed.ad "$RPM_BUILD_ROOT"%{_libdir}/X11/app-defaults/xgpsspeed
%changelog
* Thu Sep 30 2004 Eric S. Raymond <esr@snark.thyrsus.com> - @VERSION@-1
- Documentation improvements.
+ Documentation improvements. BSD port fixes. Cosmetic tweaks.
* Thu Sep 30 2004 Eric S. Raymond <esr@snark.thyrsus.com> - 2.1-1
- Various internal cleanups, including fossil removal in the
diff --git a/libgps.c b/libgps.c
index 53c68d94..b78f193b 100644
--- a/libgps.c
+++ b/libgps.c
@@ -5,7 +5,6 @@
#include <string.h>
#include <errno.h>
-#include "gps.h"
#include "gpsd.h"
struct gps_data_t *gps_open(char *host, char *port)
@@ -21,8 +20,7 @@ struct gps_data_t *gps_open(char *host, char *port)
if (!port)
port = DEFAULT_GPSD_PORT;
- if ((gpsdata->gps_fd = netlib_connectsock(host, port, "tcp")) < 0)
- {
+ if ((gpsdata->gps_fd = netlib_connectsock(host, port, "tcp")) < 0) {
errno = gpsdata->gps_fd;
return NULL;
}
@@ -124,14 +122,12 @@ static int gps_unpack(char *buf, struct gps_data_t *gpsdata)
REFRESH(gpsdata->speed_stamp);
break;
case 'X':
- if (!strncmp(sp, "X=1", 3))
- {
+ if (!strncmp(sp, "X=1", 3)) {
gpsdata->online_stamp.changed = gpsdata->online != 1;
gpsdata->online = 1;
REFRESH(gpsdata->online_stamp);
}
- else if (!strncmp(sp, "X=0", 3))
- {
+ else if (!strncmp(sp, "X=0", 3)) {
gpsdata->online_stamp.changed = gpsdata->online != 0;
gpsdata->online = 0;
REFRESH(gpsdata->online_stamp);
@@ -141,8 +137,7 @@ static int gps_unpack(char *buf, struct gps_data_t *gpsdata)
i1 = atoi(sp+2);
gpsdata->satellite_stamp.changed = (gpsdata->satellites != i1);
gpsdata->satellites = i1;
- if (gpsdata->satellites)
- {
+ if (gpsdata->satellites) {
int j, i3, i4, i5;
int PRN[MAXCHANNELS];
int elevation[MAXCHANNELS];
@@ -234,52 +229,45 @@ void data_dump(struct gps_data_t *collect, time_t now)
if (collect->online_stamp.changed)
printf("online: %d\n", collect->online);
- if (collect->latlon_stamp.changed)
- {
+ if (collect->latlon_stamp.changed) {
printf("P: lat/lon: %lf %lf",
collect->latitude, collect->longitude);
printf("(lr=%ld, changed=%d)\n",
collect->latlon_stamp.last_refresh,
collect->latlon_stamp.changed);
}
- if (collect->altitude_stamp.changed)
- {
+ if (collect->altitude_stamp.changed) {
printf("A: altitude: %lf ", collect->altitude);
printf("(lr=%ld, changed=%d)\n",
collect->altitude_stamp.last_refresh,
collect->altitude_stamp.changed);
}
- if (collect->speed_stamp.changed)
- {
+ if (collect->speed_stamp.changed) {
printf("V: speed: %lf ", collect->speed);
printf("(lr=%ld, changed=%d)\n",
collect->speed_stamp.last_refresh,
collect->speed_stamp.changed);
}
- if (collect->track_stamp.changed)
- {
+ if (collect->track_stamp.changed) {
printf("T: track: %lf ", collect->track);
printf("(lr=%ld, changed=%d)\n",
collect->track_stamp.last_refresh,
collect->track_stamp.changed);
}
- if (collect->status_stamp.changed)
- {
+ if (collect->status_stamp.changed) {
printf("S: status: %d (%s) ",
collect->status,status_values[collect->status]);
printf("(lr=%ld, changed=%d)\n",
collect->status_stamp.last_refresh,
collect->status_stamp.changed);
}
- if (collect->mode_stamp.changed)
- {
+ if (collect->mode_stamp.changed) {
printf("M: mode: %d (%s) ", collect->mode, mode_values[collect->mode]);
printf("(lr=%ld, changed=%d)",
collect->mode_stamp.last_refresh,
collect->mode_stamp.changed);
}
- if (collect->fix_quality_stamp.changed)
- {
+ if (collect->fix_quality_stamp.changed) {
printf("Q: satellites %d, pdop=%lf, hdop=%lf, vdop=%lf ",
collect->satellites_used,
collect->pdop, collect->hdop, collect->vdop);
@@ -287,8 +275,7 @@ void data_dump(struct gps_data_t *collect, time_t now)
collect->fix_quality_stamp.last_refresh,
collect->fix_quality_stamp.changed);
}
- if (collect->satellite_stamp.changed)
- {
+ if (collect->satellite_stamp.changed) {
int i;
printf("Y: satellites in view: %d\n", collect->satellites);
@@ -329,12 +316,10 @@ main(int argc, char *argv[])
if (tty)
fputs("This is the gpsd exerciser.\n", stdout);
- for (;;)
- {
+ for (;;) {
if (tty)
fputs("> ", stdout);
- if (fgets(buf, sizeof(buf), stdin) == NULL)
- {
+ if (fgets(buf, sizeof(buf), stdin) == NULL) {
if (tty)
putchar('\n');
break;
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 8a38e8ff..0e195430 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -2,14 +2,16 @@
* This provides the interface to the library that supports direct access to
* GPSes on serial or USB devices.
*/
+#include "config.h"
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <netdb.h>
#include <sys/ioctl.h>
+#ifdef HAVE_SYS_FILIO_H
+#include <sys/filio.h> /* for FIONREAD on BSD systems */
+#endif
-#include "config.h"
-#include "gps.h"
#include "gpsd.h"
#ifdef NON_NMEA_ENABLE
@@ -32,7 +34,6 @@ struct gps_session_t *gpsd_init(char devicetype, char *dgpsserver)
/* initialize GPS polling */
{
time_t now = time(NULL);
-
struct gps_session_t *session = (struct gps_session_t *)calloc(sizeof(struct gps_session_t), 1);
if (!session)
@@ -61,7 +62,6 @@ struct gps_session_t *gpsd_init(char devicetype, char *dgpsserver)
dgpsport = colon+1;
*colon = '\0';
}
-
if (!getservbyname(dgpsport, "tcp"))
dgpsport = "2101";
@@ -145,8 +145,7 @@ int gpsd_poll(struct gps_session_t *session)
char buf[BUFSIZE];
int rtcmbytes;
- if ((rtcmbytes=read(session->dsock,buf,BUFSIZE))>0 && (session->gNMEAdata.gps_fd !=-1))
- {
+ if ((rtcmbytes=read(session->dsock,buf,BUFSIZE))>0 && (session->gNMEAdata.gps_fd !=-1)) {
if (session->device_type->rtcm_writer(session, buf, rtcmbytes) <= 0)
gpsd_report(1, "Write to rtcm sink failed\n");
else
diff --git a/netlib.c b/netlib.c
index 9093e3fd..1e767c1b 100644
--- a/netlib.c
+++ b/netlib.c
@@ -6,7 +6,6 @@
#include <netdb.h>
#include <arpa/inet.h>
-#include "gps.h"
#include "gpsd.h"
#if !defined (INADDR_NONE)
diff --git a/nmea_parse.c b/nmea_parse.c
index 40c1bcb5..524ab0fe 100644
--- a/nmea_parse.c
+++ b/nmea_parse.c
@@ -6,7 +6,6 @@
#include <string.h>
#include <stdarg.h>
-#include "gps.h"
#include "gpsd.h"
/**************************************************************************
@@ -223,8 +222,7 @@ static void processGPGLL(char *sentence, struct gps_data_t *out)
*/
char *status = field(sentence, 7);
- if (!strcmp(field(sentence, 6), "A") && status[0] != 'N')
- {
+ if (!strcmp(field(sentence, 6), "A") && status[0] != 'N') {
int newstatus = out->status;
do_lat_lon(sentence, 1, out);
@@ -300,8 +298,7 @@ static void processGPGGA(char *sentence, struct gps_data_t *out)
out->status_stamp.changed = update_field_i(sentence, 6, &out->status);
REFRESH(out->status_stamp);
gpsd_report(3, "GPGGA sets status %d\n", out->status);
- if (out->status > STATUS_NO_FIX)
- {
+ if (out->status > STATUS_NO_FIX) {
char *altitude;
fake_mmddyyyy(out);
@@ -428,8 +425,7 @@ static void processGPGSV(char *sentence, struct gps_data_t *out)
/* not valid data until we've seen a complete set of parts */
if (out->part < out->await)
gpsd_report(3, "Partial satellite data (%d of %d).\n", out->part, out->await);
- else
- {
+ else {
/* trim off PRNs with spurious data attached */
while (out->satellites
&& !out->elevation[out->satellites-1]
diff --git a/serial.c b/serial.c
index 906ace5b..b24f3c80 100644
--- a/serial.c
+++ b/serial.c
@@ -11,7 +11,6 @@
#endif
#endif
-#include "gps.h"
#include "gpsd.h"
/* FIXME: these shouldn't be globals */
@@ -19,24 +18,20 @@ static struct termios ttyset, ttyset_old;
static int set_baud(long baud)
{
- int speed;
-
if (baud < 200)
baud *= 1000;
if (baud < 2400)
- speed = B1200;
+ return B1200;
else if (baud < 4800)
- speed = B2400;
+ return B2400;
else if (baud < 9600)
- speed = B4800;
+ return B4800;
else if (baud < 19200)
- speed = B9600;
+ return B9600;
else if (baud < 38400)
- speed = B19200;
+ return B19200;
else
- speed = B38400;
-
- return speed;
+ return B38400;
}
int gpsd_open(char *device_name, int device_speed, int stopbits)
diff --git a/xgpsspeed.c b/xgpsspeed.c
index 329962b1..df7259a1 100644
--- a/xgpsspeed.c
+++ b/xgpsspeed.c
@@ -34,8 +34,7 @@ static XrmOptionDescRec options[] = {
{"-needlecolor","*needleColor", XrmoptionSepArg, NULL},
};
-String fallback_resources[] =
-{
+String fallback_resources[] = {
NULL
};
@@ -75,7 +74,6 @@ int main(int argc, char **argv)
exit(1);
}
}
-
if (optind < argc) {
server = strdup(argv[optind]);
colon = strchr(server, ':');
@@ -109,9 +107,6 @@ int main(int argc, char **argv)
base, NULL, 0);
XtRealizeWidget(toplevel);
- /*
- * Essentially all the interface to libgps happens below here
- */
gpsdata = gps_open(server, DEFAULT_GPSD_PORT);
if (!gpsdata) {
fprintf(stderr, "xgpsspeed: no gpsd running or network error (%d).\n", errno);
diff --git a/zodiac.c b/zodiac.c
index 3790075c..59dd7c2a 100644
--- a/zodiac.c
+++ b/zodiac.c
@@ -9,7 +9,6 @@
#include <string.h>
#include <unistd.h>
-#include "gps.h"
#include "gpsd.h"
#ifdef ZODIAC_ENABLE
@@ -157,19 +156,16 @@ static int zodiac_send_rtcm(struct gps_session_t *session,
return 1;
}
-
static long getlong(void *p)
{
return *(long *) p;
}
-
static unsigned long getulong(void *p)
{
return *(unsigned long *) p;
}
-
static double degtodm(double a)
{
double d, m, t;
@@ -433,14 +429,12 @@ static void analyze(struct gps_session_t *session,
}
}
-
static int putword(unsigned short *p, unsigned char c, unsigned int n)
{
*(((unsigned char *) p) + n) = c;
return (n == 0);
}
-
static void zodiac_eat(struct gps_session_t *session, unsigned char c)
{
static int state = ZODIAC_HUNT_FF;
@@ -488,7 +482,6 @@ static void zodiac_eat(struct gps_session_t *session, unsigned char c)
case ZODIAC_HUNT_CS:
if (!(byte = putword(&(h.csum), c, byte))) {
-
if (h.csum == zodiac_checksum((unsigned short *) &h, 4)) {
state = ZODIAC_HUNT_DATA;
data = (unsigned short *) malloc((h.ndata + 1) * 2);