summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bsd-base64.c3
-rw-r--r--bsd-base64.h4
-rw-r--r--configure.ac4
-rw-r--r--driver_rtcm3.c5
-rw-r--r--driver_zodiac.c2
-rw-r--r--drivers.c5
-rw-r--r--gps.h350
-rw-r--r--gpsctl.c5
-rw-r--r--gpsd.h-head1
-rw-r--r--gpspipe.c13
-rw-r--r--lcdgps.c27
-rw-r--r--libgps.xml4
-rw-r--r--libgpsd_core.c17
-rw-r--r--net_dgpsip.c13
-rw-r--r--net_gnss_dispatch.c6
-rw-r--r--net_ntrip.c11
-rw-r--r--netlib.c10
-rw-r--r--ntpshm.c11
-rw-r--r--packet.c10
-rw-r--r--pseudonmea.c15
-rw-r--r--serial.c2
21 files changed, 295 insertions, 223 deletions
diff --git a/bsd-base64.c b/bsd-base64.c
index f182e6e8..67bbb352 100644
--- a/bsd-base64.c
+++ b/bsd-base64.c
@@ -43,6 +43,8 @@
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
+#include <stdlib.h>
+#include "gpsd_config.h"
#if !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP)
#include <sys/types.h>
@@ -51,7 +53,6 @@
#include <stdlib.h>
#include <string.h>
-#include "gpsd_config.h"
#include "bsd-base64.h"
#define Assert(Cond) if (!(Cond)) abort()
diff --git a/bsd-base64.h b/bsd-base64.h
index 44fc92cc..5e7d7ff3 100644
--- a/bsd-base64.h
+++ b/bsd-base64.h
@@ -4,9 +4,9 @@
#ifndef HAVE___B64_NTOP
# ifndef HAVE_B64_NTOP
-int b64_ntop(u_char const *src, size_t srclength, char *target,
+int b64_ntop(unsigned char const *src, size_t srclength, char *target,
size_t targsize);
-int b64_pton(char const *src, u_char *target, size_t targsize);
+int b64_pton(char const *src, unsigned char *target, size_t targsize);
# endif /* !HAVE_B64_NTOP */
# define __b64_ntop b64_ntop
# define __b64_pton b64_pton
diff --git a/configure.ac b/configure.ac
index 367b1605..2bdcabeb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,14 +161,14 @@ if eval "test x$GCC = xyes"; then
dnl -Wcast-qual -W
fi
-AC_CHECK_HEADERS(sys/termios.h sys/select.h sys/time.h sys/modem.h sys/ipc.h sys/shm.h sys/stat.h sys/socket.h)
+AC_CHECK_HEADERS(sys/termios.h sys/select.h sys/time.h sys/modem.h sys/ipc.h sys/shm.h sys/stat.h sys/socket.h sys/ioctl.h sys/un.h)
AC_CHECK_HEADERS(arpa/inet.h netinet/in_systm.h netinet/in.h netinet/tcp.h)
AC_CHECK_HEADERS([netinet/ip.h], [], [],
[[#if HAVE_NETINET_IN_SYSTM_H && HAVE_NETINET_IN_H
#include netinet/ip.h
#endif
]])
-AC_CHECK_HEADERS(termios.h strings.h getopt.h netdb.h)
+AC_CHECK_HEADERS(termios.h strings.h getopt.h netdb.h syslog.h pwd.h grp.h)
AC_CHECK_FUNCS(round, roundf)
AC_CHECK_FUNCS(strlcpy)
diff --git a/driver_rtcm3.c b/driver_rtcm3.c
index a4f5631b..5cc2ad6a 100644
--- a/driver_rtcm3.c
+++ b/driver_rtcm3.c
@@ -34,8 +34,11 @@ firmware.
#include <stdbool.h>
#include <stdio.h>
#include <assert.h>
+#include "gpsd_config.h"
#ifndef S_SPLINT_S
-#include <arpa/inet.h> /* for ntohl(3) and friends */
+ #ifdef HAVE_ARPA_INET
+ #include <arpa/inet.h> /* for ntohl(3) and friends */
+ #endif /* HAVE_ARPA_INET */
#endif /* S_SPLINT_S */
#include "gpsd.h"
diff --git a/driver_zodiac.c b/driver_zodiac.c
index 0ae83761..71b8f59c 100644
--- a/driver_zodiac.c
+++ b/driver_zodiac.c
@@ -54,7 +54,7 @@ static int end_write(int fd, void *d, int len)
}
#else
#define end_write write
-#endif
+#endif /* WORDS_BIGENDIAN */
static ssize_t zodiac_spew(struct gps_device_t *session, unsigned short type, unsigned short *dat, int dlen)
{
diff --git a/drivers.c b/drivers.c
index 79e8d344..b59032b5 100644
--- a/drivers.c
+++ b/drivers.c
@@ -1,6 +1,9 @@
/* $Id$ */
#include <sys/types.h>
-#include <sys/ioctl.h>
+#include "gpsd_config.h"
+#ifdef HAVE_SYS_IOCTL_H
+ #include <sys/ioctl.h>
+#endif /* HAVE_SYS_IOCTL_H */
#include <sys/time.h>
#include <stdlib.h>
#ifndef S_SPLINT_S
diff --git a/gps.h b/gps.h
index 8ecc2c47..50a9966d 100644
--- a/gps.h
+++ b/gps.h
@@ -203,9 +203,9 @@ struct rtcm3_rtk_hdr { /* header data from 1001, 1002, 1003, 1004 */
time_t tow; /* GPS Epoch Time (TOW) in ms,
or GLONASS Epoch Time in ms */
bool sync; /* Synchronous GNSS Message Flag */
- ushort satcount; /* # Satellite Signals Processed */
+ unsigned short satcount; /* # Satellite Signals Processed */
bool smoothing; /* Divergence-free Smoothing Indicator */
- ushort interval; /* Smoothing Interval */
+ unsigned short interval; /* Smoothing Interval */
};
struct rtcm3_basic_rtk {
@@ -218,7 +218,7 @@ struct rtcm3_basic_rtk {
};
struct rtcm3_extended_rtk {
- unsigned char indicator; /* Indicator */
+ unsigned char indicator; /* Indicator */
unsigned char channel; /* Satellite Frequency Channel Number
(GLONASS only) */
double pseudorange; /* Pseudorange */
@@ -226,7 +226,7 @@ struct rtcm3_extended_rtk {
unsigned char locktime; /* Lock time Indicator */
unsigned char ambiguity; /* Integer Pseudorange
Modulus Ambiguity */
- double CNR; /* Carrier-to-Noise Ratio */
+ double CNR; /* Carrier-to-Noise Ratio */
};
struct rtcm3_network_rtk_header {
@@ -260,14 +260,14 @@ struct rtcm3_t {
struct {
struct rtcm3_rtk_hdr header;
struct {
- unsigned ident; /* Satellite ID */
+ unsigned ident; /* Satellite ID */
struct rtcm3_basic_rtk L1;
} rtk_data[RTCM3_MAX_SATELLITES];
} rtcm3_1001;
struct {
struct rtcm3_rtk_hdr header;
struct {
- unsigned ident; /* Satellite ID */
+ unsigned ident; /* Satellite ID */
struct rtcm3_extended_rtk L1;
} rtk_data[RTCM3_MAX_SATELLITES];
} rtcm3_1002;
@@ -288,27 +288,27 @@ struct rtcm3_t {
} rtk_data[RTCM3_MAX_SATELLITES];
} rtcm3_1004;
struct {
- unsigned int station_id; /* Reference Station ID */
- int system; /* Which system is it? */
- bool reference_station; /* Reference-station indicator */
- bool single_receiver; /* Single Receiver Oscillator */
+ unsigned int station_id; /* Reference Station ID */
+ int system; /* Which system is it? */
+ bool reference_station; /* Reference-station indicator */
+ bool single_receiver; /* Single Receiver Oscillator */
double ecef_x, ecef_y, ecef_z; /* ECEF antenna location */
} rtcm3_1005;
struct {
- unsigned int station_id; /* Reference Station ID */
- int system; /* Which system is it? */
- bool reference_station; /* Reference-station indicator */
- bool single_receiver; /* Single Receiver Oscillator */
+ unsigned int station_id; /* Reference Station ID */
+ int system; /* Which system is it? */
+ bool reference_station; /* Reference-station indicator */
+ bool single_receiver; /* Single Receiver Oscillator */
double ecef_x, ecef_y, ecef_z; /* ECEF antenna location */
double height; /* Antenna height */
} rtcm3_1006;
struct {
- unsigned int station_id; /* Reference Station ID */
+ unsigned int station_id; /* Reference Station ID */
char descriptor[RTCM3_MAX_DESCRIPTOR+1]; /* Description string */
unsigned char setup_id;
} rtcm3_1007;
struct {
- unsigned int station_id; /* Reference Station ID */
+ unsigned int station_id; /* Reference Station ID */
char descriptor[RTCM3_MAX_DESCRIPTOR+1]; /* Description string */
unsigned char setup_id;
char serial[RTCM3_MAX_DESCRIPTOR+1]; /* Serial # string */
@@ -472,201 +472,201 @@ typedef /*@unsignedintegraltype@*/ unsigned int gps_mask_t;
struct ais_t
{
- uint type; /* message type */
- uint repeat; /* Repeat indicator */
- uint mmsi; /* MMSI */
+ unsigned int type; /* message type */
+ unsigned int repeat; /* Repeat indicator */
+ unsigned int mmsi; /* MMSI */
union {
/* Types 1-3 Common navigation info */
struct {
- uint status; /* navigation status */
+ unsigned int status; /* navigation status */
signed turn; /* rate of turn */
#define AIS_TURN_HARD_LEFT -127
#define AIS_TURN_HARD_RIGHT 127
#define AIS_TURN_NOT_AVAILABLE 128
- uint speed; /* speed over ground in deciknots */
+ unsigned int speed; /* speed over ground in deciknots */
#define AIS_SPEED_NOT_AVAILABLE 1023
-#define AIS_SPEED_FAST_MOVER 1022 /* >= 102.2 knots */
- bool accuracy; /* position accuracy */
+#define AIS_SPEED_FAST_MOVER 1022 /* >= 102.2 knots */
+ bool accuracy; /* position accuracy */
#define AIS_LATLON_SCALE 600000.0
- int lon; /* longitude */
+ int lon; /* longitude */
#define AIS_LON_NOT_AVAILABLE 0x6791AC0
- int lat; /* latitude */
+ int lat; /* latitude */
#define AIS_LAT_NOT_AVAILABLE 0x3412140
- uint course; /* course over ground */
+ unsigned int course; /* course over ground */
#define AIS_COURSE_NOT_AVAILABLE 3600
- uint heading; /* true heading */
+ unsigned int heading; /* true heading */
#define AIS_HEADING_NOT_AVAILABLE 511
- uint second; /* seconds of UTC timestamp */
+ unsigned int second; /* seconds of UTC timestamp */
#define AIS_SEC_NOT_AVAILABLE 60
#define AIS_SEC_MANUAL 61
#define AIS_SEC_ESTIMATED 62
#define AIS_SEC_INOPERATIVE 63
- uint maneuver; /* maneuver indicator */
- //uint spare; spare bits */
+ unsigned int maneuver; /* maneuver indicator */
+ //unsigned int spare; spare bits */
bool raim; /* RAIM flag */
- uint radio; /* radio status bits */
+ unsigned int radio; /* radio status bits */
} type1;
/* Type 4 - Base Station Report & Type 11 - UTC and Date Response */
struct {
- uint year; /* UTC year */
+ unsigned int year; /* UTC year */
#define AIS_YEAR_NOT_AVAILABLE 0
- uint month; /* UTC month */
+ unsigned int month; /* UTC month */
#define AIS_MONTH_NOT_AVAILABLE 0
- uint day; /* UTC day */
+ unsigned int day; /* UTC day */
#define AIS_DAY_NOT_AVAILABLE 0
- uint hour; /* UTC hour */
+ unsigned int hour; /* UTC hour */
#define AIS_HOUR_NOT_AVAILABLE 24
- uint minute; /* UTC minute */
+ unsigned int minute; /* UTC minute */
#define AIS_MINUTE_NOT_AVAILABLE 60
- uint second; /* UTC second */
+ unsigned int second; /* UTC second */
#define AIS_SECOND_NOT_AVAILABLE 60
bool accuracy; /* fix quality */
int lon; /* longitude */
int lat; /* latitude */
- uint epfd; /* type of position fix device */
- //uint spare; spare bits */
+ unsigned int epfd; /* type of position fix device */
+ //unsigned int spare; spare bits */
bool raim; /* RAIM flag */
- uint radio; /* radio status bits */
+ unsigned int radio; /* radio status bits */
} type4;
/* Type 5 - Ship static and voyage related data */
struct {
- uint ais_version; /* AIS version level */
- uint imo; /* IMO identification */
+ unsigned int ais_version; /* AIS version level */
+ unsigned int imo; /* IMO identification */
char callsign[8]; /* callsign */
#define AIS_SHIPNAME_MAXLEN 20
char shipname[AIS_SHIPNAME_MAXLEN+1]; /* vessel name */
- uint shiptype; /* ship type code */
- uint to_bow; /* dimension to bow */
- uint to_stern; /* dimension to stern */
- uint to_port; /* dimension to port */
- uint to_starboard; /* dimension to starboard */
- uint epfd; /* type of position fix deviuce */
- uint month; /* UTC month */
- uint day; /* UTC day */
- uint hour; /* UTC hour */
- uint minute; /* UTC minute */
- uint draught; /* draft in meters */
+ unsigned int shiptype; /* ship type code */
+ unsigned int to_bow; /* dimension to bow */
+ unsigned int to_stern; /* dimension to stern */
+ unsigned int to_port; /* dimension to port */
+ unsigned int to_starboard; /* dimension to starboard */
+ unsigned int epfd; /* type of position fix deviuce */
+ unsigned int month; /* UTC month */
+ unsigned int day; /* UTC day */
+ unsigned int hour; /* UTC hour */
+ unsigned int minute; /* UTC minute */
+ unsigned int draught; /* draft in meters */
char destination[21]; /* ship destination */
- uint dte; /* data terminal enable */
- //uint spare; spare bits */
+ unsigned int dte; /* data terminal enable */
+ //unsigned int spare; spare bits */
} type5;
/* Type 6 - Addressed Binary Message */
struct {
- uint seqno; /* sequence number */
- uint dest_mmsi; /* destination MMSI */
+ unsigned int seqno; /* sequence number */
+ unsigned int dest_mmsi; /* destination MMSI */
bool retransmit; /* retransmit flag */
- //uint spare; spare bit(s) */
- uint app_id; /* Application ID */
+ //unsigned int spare; spare bit(s) */
+ unsigned int app_id; /* Application ID */
#define AIS_TYPE6_BINARY_MAX 920 /* 920 bits */
size_t bitcount; /* bit count of the data */
char bitdata[(AIS_TYPE6_BINARY_MAX + 7) / 8];
} type6;
/* Type 7 - Binary Acknowledge */
struct {
- uint mmsi1;
- uint mmsi2;
- uint mmsi3;
- uint mmsi4;
+ unsigned int mmsi1;
+ unsigned int mmsi2;
+ unsigned int mmsi3;
+ unsigned int mmsi4;
/* spares ignored, they're only padding here */
} type7;
/* Type 8 - Broadcast Binary Message */
struct {
- //uint spare; spare bit(s) */
- uint app_id; /* Application ID */
+ //unsigned int spare; spare bit(s) */
+ unsigned int app_id; /* Application ID */
#define AIS_TYPE8_BINARY_MAX 952 /* 952 bits */
size_t bitcount; /* bit count of the data */
char bitdata[(AIS_TYPE8_BINARY_MAX + 7) / 8];
} type8;
/* Type 9 - Standard SAR Aircraft Position Report */
struct {
- uint alt; /* altitude in meters */
+ unsigned int alt; /* altitude in meters */
#define AIS_ALT_NOT_AVAILABLE 4095
#define AIS_ALT_HIGH 4094 /* 4094 meters or higher */
- uint speed; /* speed over ground in deciknots */
+ unsigned int speed; /* speed over ground in deciknots */
#define AIS_SAR_SPEED_NOT_AVAILABLE 1023
#define AIS_SAR_FAST_MOVER 1022
bool accuracy; /* position accuracy */
int lon; /* longitude */
int lat; /* latitude */
- uint course; /* course over ground */
- uint second; /* seconds of UTC timestamp */
- uint regional; /* regional reserved */
- uint dte; /* data terminal enable */
- //uint spare; spare bits */
+ unsigned int course; /* course over ground */
+ unsigned int second; /* seconds of UTC timestamp */
+ unsigned int regional; /* regional reserved */
+ unsigned int dte; /* data terminal enable */
+ //unsigned int spare; spare bits */
bool assigned; /* assigned-mode flag */
bool raim; /* RAIM flag */
- uint radio; /* radio status bits */
+ unsigned int radio; /* radio status bits */
} type9;
/* Type 10 - UTC/Date Inquiry */
struct {
- //uint spare;
- uint dest_mmsi; /* destination MMSI */
- //uint spare2;
+ //unsigned int spare;
+ unsigned int dest_mmsi; /* destination MMSI */
+ //unsigned int spare2;
} type10;
/* Type 12 - Safety-Related Message */
struct {
- uint seqno; /* sequence number */
- uint dest_mmsi; /* destination MMSI */
+ unsigned int seqno; /* sequence number */
+ unsigned int dest_mmsi; /* destination MMSI */
bool retransmit; /* retransmit flag */
- //uint spare; spare bit(s) */
+ //unsigned int spare; spare bit(s) */
#define AIS_TYPE12_TEXT_MAX 157 /* 936 bits of six-bit, plus NUL */
char text[AIS_TYPE12_TEXT_MAX];
} type12;
/* Type 14 - Safety-Related Broadcast Message */
struct {
- //uint spare; spare bit(s) */
+ //unsigned int spare; spare bit(s) */
#define AIS_TYPE14_TEXT_MAX 161 /* 952 bits of six-bit, plus NUL */
char text[AIS_TYPE14_TEXT_MAX];
} type14;
/* Type 15 - Interrogation */
struct {
- //uint spare; spare bit(s) */
- uint mmsi1;
- uint type1_1;
- uint offset1_1;
- //uint spare2; spare bit(s) */
- uint type1_2;
- uint offset1_2;
- //uint spare3; spare bit(s) */
- uint mmsi2;
- uint type2_1;
- uint offset2_1;
- //uint spare4; spare bit(s) */
+ //unsigned int spare; spare bit(s) */
+ unsigned int mmsi1;
+ unsigned int type1_1;
+ unsigned int offset1_1;
+ //unsigned int spare2; spare bit(s) */
+ unsigned int type1_2;
+ unsigned int offset1_2;
+ //unsigned int spare3; spare bit(s) */
+ unsigned int mmsi2;
+ unsigned int type2_1;
+ unsigned int offset2_1;
+ //unsigned int spare4; spare bit(s) */
} type15;
/* Type 16 - Assigned Mode Command */
struct {
- //uint spare; spare bit(s) */
- uint mmsi1;
- uint offset1;
- uint increment1;
- uint mmsi2;
- uint offset2;
- uint increment2;
+ //unsigned int spare; spare bit(s) */
+ unsigned int mmsi1;
+ unsigned int offset1;
+ unsigned int increment1;
+ unsigned int mmsi2;
+ unsigned int offset2;
+ unsigned int increment2;
} type16;
/* Type 17 - GNSS Broadcast Binary Message */
struct {
- //uint spare; spare bit(s) */
+ //unsigned int spare; spare bit(s) */
#define AIS_GNSS_LATLON_SCALE 600.0
int lon; /* longitude */
int lat; /* latitude */
- //uint spare2; spare bit(s) */
+ //unsigned int spare2; spare bit(s) */
#define AIS_TYPE17_BINARY_MAX 736 /* 920 bits */
size_t bitcount; /* bit count of the data */
char bitdata[(AIS_TYPE17_BINARY_MAX + 7) / 8];
} type17;
/* Type 18 - Standard Class B CS Position Report */
struct {
- uint reserved; /* altitude in meters */
- uint speed; /* speed over ground in deciknots */
+ unsigned int reserved; /* altitude in meters */
+ unsigned int speed; /* speed over ground in deciknots */
bool accuracy; /* position accuracy */
int lon; /* longitude */
#define AIS_GNS_LON_NOT_AVAILABLE 0x1a838
int lat; /* latitude */
#define AIS_GNS_LAT_NOT_AVAILABLE 0xd548
- uint course; /* course over ground */
- uint heading; /* true heading */
- uint second; /* seconds of UTC timestamp */
- uint regional; /* regional reserved */
+ unsigned int course; /* course over ground */
+ unsigned int heading; /* true heading */
+ unsigned int second; /* seconds of UTC timestamp */
+ unsigned int regional; /* regional reserved */
bool cs; /* carrier sense unit flag */
bool display; /* unit has attached display? */
bool dsc; /* unit attached to radio with DSC? */
@@ -674,77 +674,77 @@ struct ais_t
bool msg22; /* can accept Message 22 management? */
bool assigned; /* assigned-mode flag */
bool raim; /* RAIM flag */
- uint radio; /* radio status bits */
+ unsigned int radio; /* radio status bits */
} type18;
/* Type 19 - Extended Class B CS Position Report */
struct {
- uint reserved; /* altitude in meters */
- uint speed; /* speed over ground in deciknots */
+ unsigned int reserved; /* altitude in meters */
+ unsigned int speed; /* speed over ground in deciknots */
bool accuracy; /* position accuracy */
int lon; /* longitude */
int lat; /* latitude */
- uint course; /* course over ground */
- uint heading; /* true heading */
- uint second; /* seconds of UTC timestamp */
- uint regional; /* regional reserved */
+ unsigned int course; /* course over ground */
+ unsigned int heading; /* true heading */
+ unsigned int second; /* seconds of UTC timestamp */
+ unsigned int regional; /* regional reserved */
char shipname[AIS_SHIPNAME_MAXLEN+1]; /* ship name */
- uint shiptype; /* ship type code */
- uint to_bow; /* dimension to bow */
- uint to_stern; /* dimension to stern */
- uint to_port; /* dimension to port */
- uint to_starboard; /* dimension to starboard */
- uint epfd; /* type of position fix deviuce */
+ unsigned int shiptype; /* ship type code */
+ unsigned int to_bow; /* dimension to bow */
+ unsigned int to_stern; /* dimension to stern */
+ unsigned int to_port; /* dimension to port */
+ unsigned int to_starboard; /* dimension to starboard */
+ unsigned int epfd; /* type of position fix deviuce */
bool raim; /* RAIM flag */
- uint dte; /* date terminal enable */
+ unsigned int dte; /* date terminal enable */
bool assigned; /* assigned-mode flag */
- //uint spare; spare bits */
+ //unsigned int spare; spare bits */
} type19;
/* Type 20 - Data Link Management Message */
struct {
- //uint spare; spare bit(s) */
- uint offset1; /* TDMA slot offset */
- uint number1; /* number of xlots to allocate */
- uint timeout1; /* allocation timeout */
- uint increment1; /* repeat increment */
- uint offset2; /* TDMA slot offset */
- uint number2; /* number of xlots to allocate */
- uint timeout2; /* allocation timeout */
- uint increment2; /* repeat increment */
- uint offset3; /* TDMA slot offset */
- uint number3; /* number of xlots to allocate */
- uint timeout3; /* allocation timeout */
- uint increment3; /* repeat increment */
- uint offset4; /* TDMA slot offset */
- uint number4; /* number of xlots to allocate */
- uint timeout4; /* allocation timeout */
- uint increment4; /* repeat increment */
+ //unsigned int spare; spare bit(s) */
+ unsigned int offset1; /* TDMA slot offset */
+ unsigned int number1; /* number of xlots to allocate */
+ unsigned int timeout1; /* allocation timeout */
+ unsigned int increment1; /* repeat increment */
+ unsigned int offset2; /* TDMA slot offset */
+ unsigned int number2; /* number of xlots to allocate */
+ unsigned int timeout2; /* allocation timeout */
+ unsigned int increment2; /* repeat increment */
+ unsigned int offset3; /* TDMA slot offset */
+ unsigned int number3; /* number of xlots to allocate */
+ unsigned int timeout3; /* allocation timeout */
+ unsigned int increment3; /* repeat increment */
+ unsigned int offset4; /* TDMA slot offset */
+ unsigned int number4; /* number of xlots to allocate */
+ unsigned int timeout4; /* allocation timeout */
+ unsigned int increment4; /* repeat increment */
} type20;
/* Type 21 - Aids to Navigation Report */
struct {
- uint aid_type; /* aid type */
+ unsigned int aid_type; /* aid type */
char name[35]; /* name of aid to navigation */
bool accuracy; /* position accuracy */
int lon; /* longitude */
int lat; /* latitude */
- uint to_bow; /* dimension to bow */
- uint to_stern; /* dimension to stern */
- uint to_port; /* dimension to port */
- uint to_starboard; /* dimension to starboard */
- uint epfd; /* type of EPFD */
- uint second; /* second of UTC timestamp */
+ unsigned int to_bow; /* dimension to bow */
+ unsigned int to_stern; /* dimension to stern */
+ unsigned int to_port; /* dimension to port */
+ unsigned int to_starboard; /* dimension to starboard */
+ unsigned int epfd; /* type of EPFD */
+ unsigned int second; /* second of UTC timestamp */
bool off_position; /* off-position indicator */
- uint regional; /* regional reserved field */
+ unsigned int regional; /* regional reserved field */
bool raim; /* RAIM flag */
bool virtual_aid; /* is virtual station? */
bool assigned; /* assigned-mode flag */
- //uint spare; unused */
+ //unsigned int spare; unused */
} type21;
/* Type 22 - Channel Management */
struct {
- //uint spare; spare bit(s) */
- uint channel_a; /* Channel A number */
- uint channel_b; /* Channel B number */
- uint txrx; /* transmit/receive mode */
+ //unsigned int spare; spare bit(s) */
+ unsigned int channel_a; /* Channel A number */
+ unsigned int channel_b; /* Channel B number */
+ unsigned int txrx; /* transmit/receive mode */
bool power; /* high-power flag */
#define AIS_CHANNEL_LATLON_SCALE 600.0
int ne_lon; /* NE corner longitude */
@@ -754,36 +754,36 @@ struct ais_t
bool addressed; /* addressed vs. broadast flag */
bool band_a; /* fix 1.5kHz band for channel A */
bool band_b; /* fix 1.5kHz band for channel B */
- uint zonesize; /* size of transitional zone */
+ unsigned int zonesize; /* size of transitional zone */
} type22;
/* Type 23 - Group Assignment Command */
struct {
- //uint spare; spare bit(s) */
+ //unsigned int spare; spare bit(s) */
int ne_lon; /* NE corner longitude */
int ne_lat; /* NE corner latitude */
int sw_lon; /* SW corner longitude */
int sw_lat; /* SW corner latitude */
- uint stationtype; /* station type code */
- uint shiptype; /* ship type code */
- //uint spare2; spare bit(s) */
- uint txrx; /* transmit-enable code */
- uint interval; /* report interval */
- uint quiet; /* quiet time */
- //uint spare3; spare bit(s) */
+ unsigned int stationtype; /* station type code */
+ unsigned int shiptype; /* ship type code */
+ //unsigned int spare2; spare bit(s) */
+ unsigned int txrx; /* transmit-enable code */
+ unsigned int interval; /* report interval */
+ unsigned int quiet; /* quiet time */
+ //unsigned int spare3; spare bit(s) */
} type23;
/* Type 24 - Class B CS Static Data Report */
struct {
char shipname[AIS_SHIPNAME_MAXLEN+1]; /* vessel name */
- uint shiptype; /* ship type code */
+ unsigned int shiptype; /* ship type code */
char vendorid[8]; /* vendor ID */
char callsign[8]; /* callsign */
union {
- uint mothership_mmsi; /* MMSI of main vessel */
+ unsigned int mothership_mmsi; /* MMSI of main vessel */
struct {
- uint to_bow; /* dimension to bow */
- uint to_stern; /* dimension to stern */
- uint to_port; /* dimension to port */
- uint to_starboard; /* dimension to starboard */
+ unsigned int to_bow; /* dimension to bow */
+ unsigned int to_stern; /* dimension to stern */
+ unsigned int to_port; /* dimension to port */
+ unsigned int to_starboard; /* dimension to starboard */
} dim;
};
} type24;
@@ -791,8 +791,8 @@ struct ais_t
struct {
bool addressed; /* addressed-vs.broadcast flag */
bool structured; /* structured-binary flag */
- uint dest_mmsi; /* destination MMSI */
- uint app_id; /* Application ID */
+ unsigned int dest_mmsi; /* destination MMSI */
+ unsigned int app_id; /* Application ID */
#define AIS_TYPE25_BINARY_MAX 128 /* Up to 128 bits */
size_t bitcount; /* bit count of the data */
char bitdata[(AIS_TYPE25_BINARY_MAX + 7) / 8];
@@ -801,12 +801,12 @@ struct ais_t
struct {
bool addressed; /* addressed-vs.broadcast flag */
bool structured; /* structured-binary flag */
- uint dest_mmsi; /* destination MMSI */
- uint app_id; /* Application ID */
+ unsigned int dest_mmsi; /* destination MMSI */
+ unsigned int app_id; /* Application ID */
#define AIS_TYPE26_BINARY_MAX 1004 /* Up to 128 bits */
size_t bitcount; /* bit count of the data */
char bitdata[(AIS_TYPE26_BINARY_MAX + 7) / 8];
- uint radio; /* radio status bits */
+ unsigned int radio; /* radio status bits */
} type26;
};
};
@@ -860,8 +860,8 @@ struct rawdata_t {
#define TYPES_PER_DEVICE 4
struct version_t {
- char release[64]; /* external version */
- char rev[64]; /* internal revision ID */
+ char release[64]; /* external version */
+ char rev[64]; /* internal revision ID */
int proto_major, proto_minor; /* API major and minor versions */
};
@@ -875,7 +875,7 @@ struct devconfig_t {
char driver[64];
char subtype[64];
double activated;
- uint baudrate, stopbits; /* RS232 link parameters */
+ unsigned int baudrate, stopbits; /* RS232 link parameters */
char parity; /* 'N', 'O', or 'E' */
double cycle, mincycle; /* refresh cycle time in seconds */
int driver_mode; /* is driver in native mode or not? */
diff --git a/gpsctl.c b/gpsctl.c
index 2e08b6f4..49c2f0d0 100644
--- a/gpsctl.c
+++ b/gpsctl.c
@@ -5,7 +5,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
-#include <sys/ioctl.h>
+#include "gpsd_config.h"
+#if HAVE_SYS_IOCTL_H
+ #include <sys/ioctl.h>
+#endif /* HAVE_SYS_IOCTL_H */
#ifndef S_SPLINT_S
#include <unistd.h>
#endif /* S_SPLINT_S */
diff --git a/gpsd.h-head b/gpsd.h-head
index a915fe96..f9d00654 100644
--- a/gpsd.h-head
+++ b/gpsd.h-head
@@ -4,6 +4,7 @@
#ifndef _GPSD_H_
#define _GPSD_H_
+#include "gpsd_config.h"
#include <stdbool.h>
#include <stdio.h>
#ifdef HAVE_TERMIOS_H
diff --git a/gpspipe.c b/gpspipe.c
index 79e44698..27b04040 100644
--- a/gpspipe.c
+++ b/gpspipe.c
@@ -22,26 +22,30 @@
* license they use. A thank you would be nice if you use this code.
*/
+#include <stdlib.h>
+#include "gpsd_config.h"
#include <sys/types.h>
#include <sys/stat.h>
#ifndef S_SPLINT_S
-#include <sys/socket.h>
+ #if HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif /* HAVE_SYS_SOCKET_H */
#include <unistd.h>
#endif /* S_SPLINT_S */
#include <errno.h>
#include <stdio.h>
#include <string.h>
-#include <stdlib.h>
#include <stdbool.h>
#include <fcntl.h>
-#include <termios.h>
+#if HAVE_TERMIOS
+ #include <termios.h>
+#endif /* HAVE_TERMIOS */
#include <assert.h>
#include "gpsd.h"
#include "gpsdclient.h"
#include "revision.h"
static struct gps_data_t *gpsdata;
-static int fd_out = 1; /* output initially goes to standard output */
static void spinner(unsigned int, unsigned int);
/* NMEA-0183 standard baud rate */
@@ -49,6 +53,7 @@ static void spinner(unsigned int, unsigned int);
/* Serial port variables */
static struct termios oldtio, newtio;
+static int fd_out = 1; /* output initially goes to standard output */
static char serbuf[255];
static int debug;
diff --git a/lcdgps.c b/lcdgps.c
index fe9d8711..2e5f9126 100644
--- a/lcdgps.c
+++ b/lcdgps.c
@@ -35,8 +35,9 @@
#define CLIMB 3
-#include <stdio.h>
#include <stdlib.h>
+#include "gpsd_config.h"
+#include <stdio.h>
#include <string.h>
#include <ctype.h>
#ifndef S_SPLINT_S
@@ -44,20 +45,32 @@
#endif /* S_SPLINT_S */
#include <math.h>
#include <errno.h>
-#include <sys/select.h>
+#ifdef HAVE_SYS_SELECT_H
+ #include <sys/select.h>
+#endif /* HAVE_SYS_SELECT_H */
#ifndef S_SPLINT_S
-#include <sys/socket.h>
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif /* HAVE_SYS_SOCKET_H */
#endif /* S_SPLINT_S */
#include <sys/time.h> /* select() */
#include <sys/stat.h>
#include <fcntl.h>
-#include <termios.h>
+#ifdef HAVE_TERMIOS_H
+ #include <termios.h>
+#endif /* HAVE_TERMIOS_H */
#ifndef S_SPLINT_S
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
+ #ifdef HAVE_NETINET_IN_H
+ #include <netinet/in.h>
+ #endif /* HAVE_NETINET_IN_H */
+ #ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
+ #endif /* HAVE_ARPA_INET_H */
+ #ifdef HAVE_NETDB_H
+ #include <netdb.h>
+ #endif /* HAVE_NETDB_H */
#endif /* S_SPLINT_S */
#include <errno.h>
diff --git a/libgps.xml b/libgps.xml
index 3d854de6..5993a189 100644
--- a/libgps.xml
+++ b/libgps.xml
@@ -105,7 +105,7 @@ at
<warning><para>The API described below may change incompatibly at API
version 4. Take care to conditionalize your code on the major and
minor API version symbols in <filename>gps.h</filename>; ideally,
-force a compilation failure if the header is not exporting a version
+force a compilation failure if GPSD_API_MAJOR_VERSION is not a version
you recognize. See the GPSD project website for more information on
the protocol and API changes.</para></warning>
@@ -323,7 +323,7 @@ command is shipped to it will be the reponse to command.</para>
<function>gps_send()</function> but beware that this ties your code to
the GPSD wire protocol. It is not recommended.</para>
-<para>Thia API has been stable since GPSD 2.90, except that
+<para>This API has been stable since GPSD 2.90, except that
<function>gps_waiting()</function> was added in 2.91.</para>
</refsect1>
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 20457217..4d121792 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -1,17 +1,24 @@
/* $Id$ */
/* libgpsd_core.c -- direct access to GPSes on serial or USB devices. */
+#include <stdlib.h>
+#include "gpsd_config.h"
#include <sys/time.h>
-#include <sys/ioctl.h>
+#ifdef HAVE_SYS_IOCTL_H
+ #include <sys/ioctl.h>
+#endif /* HAVE_SYS_IOCTL_H */
#ifndef S_SPLINT_S
-#include <sys/socket.h>
-#include <unistd.h>
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif /* HAVE_SYS_SOCKET_H */
+ #include <unistd.h>
#endif /* S_SPLINT_S */
#include <sys/time.h>
-#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#ifndef S_SPLINT_S
-#include <netdb.h>
+ #ifdef HAVE_NETDB_H
+ #include <netdb.h>
+ #endif /* HAVE_NETDB_H */
#endif /* S_SPLINT_S */
#include <string.h>
#include <errno.h>
diff --git a/net_dgpsip.c b/net_dgpsip.c
index e771e5ec..9829d2bb 100644
--- a/net_dgpsip.c
+++ b/net_dgpsip.c
@@ -1,16 +1,21 @@
/* $Id$ */
/* net_dgpsip.c -- gather and dispatch DGPS data from DGPSIP servers */
+#include <stdlib.h>
+#include "gpsd_config.h"
#include <sys/types.h>
#ifndef S_SPLINT_S
-#include <sys/socket.h>
-#include <unistd.h>
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif /* HAVE_SYS_SOCKET_H */
+ #include <unistd.h>
#endif /* S_SPLINT_S */
#include <sys/time.h>
-#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#ifndef S_SPLINT_S
-#include <netdb.h>
+ #ifdef HAVE_NETDB_H
+ #include <netdb.h>
+ #endif /* HAVE_NETDB_H */
#endif /* S_SPLINT_S */
#include <string.h>
#include <errno.h>
diff --git a/net_gnss_dispatch.c b/net_gnss_dispatch.c
index c631b4f5..cb2970e2 100644
--- a/net_gnss_dispatch.c
+++ b/net_gnss_dispatch.c
@@ -1,9 +1,13 @@
/* $Id$ */
/* net_gnss_dispatch.c -- common interface to a number of Network GNSS services */
+#include <stdlib.h>
+#include "gpsd_config.h"
#include <sys/types.h>
#ifndef S_SPLINT_S
-#include <sys/socket.h>
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
#include <unistd.h>
#endif /* S_SPLINT_S */
#include <string.h>
diff --git a/net_ntrip.c b/net_ntrip.c
index 54395e81..55339b54 100644
--- a/net_ntrip.c
+++ b/net_ntrip.c
@@ -1,16 +1,21 @@
/* $Id$ */
/* net_ntrip.c -- gather and dispatch DGNSS data from Ntrip broadcasters */
+#include <stdlib.h>
+#include "gpsd_config.h"
#include <sys/types.h>
#ifndef S_SPLINT_S
-#include <sys/socket.h>
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif /* HAVE_SYS_SOCKET_H */
#include <unistd.h>
#endif /* S_SPLINT_S */
#include <sys/time.h>
-#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#ifndef S_SPLINT_S
-#include <netdb.h>
+ #ifdef HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
#endif /* S_SPLINT_S */
#include <string.h>
#include <errno.h>
diff --git a/netlib.c b/netlib.c
index e5287a98..10d4df5b 100644
--- a/netlib.c
+++ b/netlib.c
@@ -18,8 +18,12 @@
#endif
#endif /* S_SPLINT_S */
#ifndef S_SPLINT_S
-#include <netdb.h>
-#include <arpa/inet.h>
+ #ifdef HAVE_NETDB_H
+ #include <netdb.h>
+ #endif /* HAVE_NETDB_H */
+ #ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
+ #endif /* HAVE_ARPA_INET_H */
#endif /* S_SPLINT_S */
#include <errno.h>
#include <stdlib.h>
@@ -88,7 +92,7 @@ socket_t netlib_connectsock(const char *host, const char *service, const char *p
#endif
#ifdef TCP_NODELAY
if (type == SOCK_STREAM)
- setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &one, sizeof one);
+ setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof one);
#endif
return s;
/*@ +type +mustfreefresh @*/
diff --git a/ntpshm.c b/ntpshm.c
index 9a5a8f54..9f99c2f7 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -5,13 +5,14 @@
* sht.c - Testprogram for shared memory refclock
*/
+#include <stdlib.h>
+#include "gpsd_config.h"
#include <sys/types.h>
#ifndef S_SPLINT_S
#include <unistd.h>
#endif /* S_SPLINT_S */
#include <stdio.h>
#include <string.h>
-#include <stdlib.h>
#include <math.h>
#include <errno.h>
@@ -22,8 +23,12 @@
#include <sys/time.h>
#endif
-#include <sys/ipc.h>
-#include <sys/shm.h>
+#ifdef HAVE_SYS_IPC_H
+ #include <sys/ipc.h>
+#endif /* HAVE_SYS_IPC_H */
+#ifdef HAVE_SYS_SHM_H
+ #include <sys/shm.h>
+#endif /* HAVE_SYS_SHM_H */
#define PPS_MAX_OFFSET 100000 /* microseconds the PPS can 'pull' */
#define PUT_MAX_OFFSET 1000000 /* microseconds for lost lock */
diff --git a/packet.c b/packet.c
index 01feb0c4..571b5a85 100644
--- a/packet.c
+++ b/packet.c
@@ -24,6 +24,8 @@ connected to the Garmin kernel driver. But we need to be able to tell the
others apart and distinguish them from baud barf.
***************************************************************************/
+#include <stdlib.h>
+#include "gpsd_config.h"
#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
@@ -33,8 +35,12 @@ others apart and distinguish them from baud barf.
#include <string.h>
#include <errno.h>
#ifndef S_SPLINT_S
-#include <netinet/in.h> /* for htons() */
-#include <arpa/inet.h> /* for htons() */
+ #ifdef HAVE_NETINET_IN_H
+ #include <netinet/in.h> /* for htons() */
+ #endif /* HAVE_NETNET_IN_H */
+ #ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h> /* for htons() */
+ #endif /* HAVE_ARPA_INET_H */
#endif /* S_SPLINT_S */
#include "bits.h"
diff --git a/pseudonmea.c b/pseudonmea.c
index 26c785e4..dcc1f0ba 100644
--- a/pseudonmea.c
+++ b/pseudonmea.c
@@ -1,15 +1,22 @@
+#include <stdlib.h>
+#include "gpsd_config.h"
#include <sys/time.h>
-#include <sys/ioctl.h>
+#ifdef HAVE_SYS_IOCTL_H
+ #include <sys/ioctl.h>
+#endif /* HAVE_SYS_IOCTL_H */
#ifndef S_SPLINT_S
-#include <sys/socket.h>
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif /* HAVE_SYS_SOCKET_H */
#include <unistd.h>
#endif /* S_SPLINT_S */
#include <sys/time.h>
-#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#ifndef S_SPLINT_S
-#include <netdb.h>
+ #ifdef HAVE_NETDB_H
+ #include <netdb.h>
+ #endif /* HAVE_NETDB_H */
#endif /* S_SPLINT_S */
#include <string.h>
#include <errno.h>
diff --git a/serial.c b/serial.c
index 911cc6b6..1e9f666b 100644
--- a/serial.c
+++ b/serial.c
@@ -89,7 +89,7 @@ void gpsd_set_speed(struct gps_device_t *session,
/*
* Yes, you can set speeds that aren't in the hunt loop. If you
- * do this, and you aren't on Linux where boad rate is preserved
+ * do this, and you aren't on Linux where baud rate is preserved
* across port closings, you've screwed yourself. Don't do that!
*/
if (speed < 300)