summaryrefslogtreecommitdiff
path: root/gpsmon.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-09-19 18:55:02 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-09-19 18:55:02 +0000
commit97ef3ea0e1c747952f9ad0e8839cfbeacf5c6451 (patch)
tree228cee78afde588b0841cdd53104b2c2a71ad152 /gpsmon.c
parent5a8122e290d01408018702063d32612a946d0946 (diff)
downloadgpsd-97ef3ea0e1c747952f9ad0e8839cfbeacf5c6451.tar.gz
Get rid of special command-shipping code.
Diffstat (limited to 'gpsmon.c')
-rw-r--r--gpsmon.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/gpsmon.c b/gpsmon.c
index 3c01293a..7d5e5a86 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -312,25 +312,6 @@ static long tzoffset(void)
return res;
}
-static void command(char buf[], size_t len, const char *fmt, ... )
-/* assemble command in printf(3) style, use stderr or syslog */
-{
- va_list ap;
- ssize_t n;
-
- va_start(ap, fmt) ;
- (void)vsnprintf(buf, len, fmt, ap);
- va_end(ap);
-
- /*@i1@*/assert(write(session.gpsdata.gps_fd, buf, strlen(buf)) != -1);
- n = read(session.gpsdata.gps_fd, buf, len);
- if (n >= 0) {
- buf[n] = '\0';
- while (isspace(buf[strlen(buf)-1]))
- buf[strlen(buf)-1] = '\0';
- }
-}
-
void monitor_complain(const char *fmt, ...)
{
va_list ap;
@@ -507,12 +488,12 @@ int main (int argc, char **argv)
/*@ -compdef @*/
// FIXME: This code needs to become protocol-agnostic
if (source.device != NULL)
- command((char *)buf, sizeof(buf), "F=%s\r\n", source.device);
+ gps_query(&session.gpsdata, "F=%s\r\n", source.device);
else
- command((char *)buf, sizeof(buf), "O\r\n"); /* force device allocation */
- command((char *)buf, sizeof(buf), "F\r\n");
+ gps_query(&session.gpsdata, "O\r\n"); /* force device allocation */
+ gps_query(&session.gpsdata, "F\r\n");
(void)strlcpy(session.gpsdata.dev.path, (char *)buf+7, PATH_MAX);
- command((char *)buf, sizeof(buf), "R=2\r\n");
+ gps_query(&session.gpsdata, "R=2\r\n");
/*@ +compdef @*/
serial = false;
} else {