summaryrefslogtreecommitdiff
path: root/libgps_sock.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-08-26 14:47:05 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-08-26 14:47:05 -0400
commit574a52109b76e59e71fd4a8099ba0493e47e1e41 (patch)
tree210e232cc0d83eaf2db63726db52182437d13bd2 /libgps_sock.c
parent13c7e896247e24d86b10249ce73d999559a99727 (diff)
downloadgpsd-574a52109b76e59e71fd4a8099ba0493e47e1e41.tar.gz
Make the sock_export=no build.
The way I fixed this extends the library API so some functions which were previously undefined for shm transport are now defined. This doesn't change the binary API of the library in the normal (sock_export=yes) case at all, so I'm not bumping its version. No changes in the daemon. All regression tests pass (in the normal sock_export=yes build).
Diffstat (limited to 'libgps_sock.c')
-rw-r--r--libgps_sock.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/libgps_sock.c b/libgps_sock.c
index 159da239..eda50f8c 100644
--- a/libgps_sock.c
+++ b/libgps_sock.c
@@ -10,7 +10,6 @@
#include <string.h>
#include <ctype.h>
#include <errno.h>
-#include <stdarg.h>
#include <math.h>
#include <locale.h>
#include <assert.h>
@@ -32,6 +31,7 @@
#include "gps.h"
#include "gpsd.h"
+#ifdef SOCKET_EXPORT_ENABLE
#include "gps_json.h"
#ifdef S_SPLINT_S
@@ -94,7 +94,7 @@ int gps_sock_open(/*@null@*/const char *host, /*@null@*/const char *port,
}
/*@+branchstate@*/
-bool gps_waiting(const struct gps_data_t *gpsdata, int timeout)
+bool gps_sock_waiting(const struct gps_data_t *gpsdata, int timeout)
/* is there input waiting from the GPS? */
{
#ifndef USE_QT
@@ -467,23 +467,15 @@ int gps_unpack(char *buf, struct gps_data_t *gpsdata)
}
/*@ +compdef @*/
-const char /*@observer@*/ *gps_data(const struct gps_data_t *gpsdata)
+const char /*@observer@*/ *gps_sock_data(const struct gps_data_t *gpsdata)
/* return the contents of the client data buffer */
{
return PRIVATE(gpsdata)->buffer;
}
-int gps_send(struct gps_data_t *gpsdata, const char *fmt, ...)
+int gps_sock_send(struct gps_data_t *gpsdata, const char *buf)
/* send a command to the gpsd instance */
{
- char buf[BUFSIZ];
- va_list ap;
-
- va_start(ap, fmt);
- (void)vsnprintf(buf, sizeof(buf) - 2, fmt, ap);
- va_end(ap);
- if (buf[strlen(buf) - 1] != '\n')
- (void)strlcat(buf, "\n", BUFSIZ);
#ifndef USE_QT
if (write(gpsdata->gps_fd, buf, strlen(buf)) == (ssize_t) strlen(buf))
return 0;
@@ -501,7 +493,7 @@ int gps_send(struct gps_data_t *gpsdata, const char *fmt, ...)
#endif
}
-int gps_stream(struct gps_data_t *gpsdata, unsigned int flags,
+int gps_sock_stream(struct gps_data_t *gpsdata, unsigned int flags,
/*@null@*/ void *d)
/* ask gpsd to stream reports at you, hiding the command details */
{
@@ -569,4 +561,6 @@ int gps_stream(struct gps_data_t *gpsdata, unsigned int flags,
}
}
+#endif /* SOCKET_EXPORT_ENABLE */
+
/* end */