diff options
author | Gary E. Miller <gem@rellim.com> | 2015-04-30 13:49:45 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2015-04-30 13:49:45 -0700 |
commit | 0de9f0dbbadb2c9ce78cac0777039db0579649f7 (patch) | |
tree | bb17b17c8da684a5077dc8f7c43b099b100c7d4f | |
parent | 7f67ff565a0e2e115f703964cd563229f9f828b3 (diff) | |
download | gpsd-0de9f0dbbadb2c9ce78cac0777039db0579649f7.tar.gz |
A gaggle of whitespace gaffs.
-rw-r--r-- | gps2udp.c | 44 | ||||
-rw-r--r-- | gpsclient.c | 2 | ||||
-rw-r--r-- | gpsctl.c | 16 | ||||
-rw-r--r-- | gpsd.c | 14 | ||||
-rw-r--r-- | gpsd_json.c | 6 | ||||
-rw-r--r-- | gpsdctl.c | 2 | ||||
-rw-r--r-- | gpsmon.c | 26 | ||||
-rw-r--r-- | gpspacket.c | 2 | ||||
-rw-r--r-- | gpspipe.c | 6 | ||||
-rw-r--r-- | gpxlogger.c | 2 |
10 files changed, 60 insertions, 60 deletions
@@ -1,7 +1,7 @@ /* * gps2udp * - * Dump NMEA to UDP socket for AIShub + * Dump NMEA to UDP socket for AIShub * gps2udp -u data.aishub.net:1234 * * Author: Fulup Ar Foll (directly inspired from gpspipe.c) @@ -56,22 +56,22 @@ static unsigned int flags; static int debug = 0; static bool aisonly = false; -static char* time2string(void) +static char* time2string(void) /* return local time hh:mm:ss */ { static char buffer[MAX_TIME_LEN]; time_t curtime; struct tm *loctime; - + /* Get the current time. */ curtime = time (NULL); - + /* Convert it to local time representation. */ loctime = localtime (&curtime); - + /* Print it out in a nice format. */ (void)strftime (buffer, sizeof(buffer), "%H:%M:%S", loctime); - + return (buffer); } @@ -175,14 +175,14 @@ static void usage(void) { (void)fprintf(stderr, "Usage: gps2udp [OPTIONS] [server[:port[:device]]]\n\n" - "-h Show this help.\n" + "-h Show this help.\n" "-u Send UDP NMEA/JASON feed to host:port [multiple -u host:port accepted\n" "-n Feed NMEA.\n" "-j Feed Jason.\n" "-a Select !AISDM message only.\n" "-c [count] exit after count packets.\n" - "-b Run in background as a daemon.\n" - "-d [0-2] 1 display sent packets, 2 ignored packets.\n" + "-b Run in background as a daemon.\n" + "-d [0-2] 1 display sent packets, 2 ignored packets.\n" "-v Print version and exit.\n\n" "example: gps2udp -a -n -c 2 -d 1 -u data.aishub.net:2222 fridu.net\n" ); @@ -218,12 +218,12 @@ static void connect2gpsd(bool restart) } /* select the right set of gps data */ (void)gps_stream(&gpsdata, flags, gpsd_source.device); - + } static ssize_t read_gpsd(char *message, size_t len) /* get data from gpsd */ -{ +{ struct timeval tv; fd_set fds,master; int ind; @@ -242,7 +242,7 @@ static ssize_t read_gpsd(char *message, size_t len) tv.tv_usec = 0; memcpy(&fds, &master, sizeof(fd_set)); result = select(gpsdata.gps_fd+1, &fds, NULL, NULL, &tv); - + switch (result) { case 1: /* we have data waiting, let's process them */ @@ -252,7 +252,7 @@ static ssize_t read_gpsd(char *message, size_t len) if (result != 1) { connect2gpsd (true); } - + if ((c == '\n') || (c == '\r')){ message[ind]='\0'; @@ -274,7 +274,7 @@ static ssize_t read_gpsd(char *message, size_t len) return(0); } } - + return ((ssize_t)ind+1); } else { message[ind]= c; @@ -384,7 +384,7 @@ int main(int argc, char **argv) break; case 'u': if (udpchannel >= MAX_UDP_DEST) { - (void)fprintf(stderr, + (void)fprintf(stderr, "gps2udp: too many UDP destinations (max=%d)\n", MAX_UDP_DEST); } else { @@ -423,7 +423,7 @@ int main(int argc, char **argv) /* Daemonize if the user requested it. */ if (daemonize) { if (daemon(0, 0) != 0) { - (void)fprintf(stderr, + (void)fprintf(stderr, "gps2udp: demonization failed: %s\n", strerror(errno)); } @@ -436,7 +436,7 @@ int main(int argc, char **argv) ssize_t len; len = read_gpsd(buffer, sizeof(buffer)); - + /* ignore empty message */ if (len > 3) { @@ -466,10 +466,10 @@ int main(int argc, char **argv) bitstrings[i] = AISto6bit(info[5][i]); } - mmsi = AISGetInt(bitstrings, 9, 30); + mmsi = AISGetInt(bitstrings, 9, 30); (void)fprintf(stdout," MMSI=%9u", mmsi); - } + } fprintf(stdout,"\n"); } @@ -481,14 +481,14 @@ int main(int argc, char **argv) if (count >= 0) { if (count-- == 0) { /* completed count */ - (void)fprintf(stderr, + (void)fprintf(stderr, "gpsd2udp: normal exit after counted packets\n"); exit (0); } - } // end count + } // end count } // end len > 3 } // end for (;;) - + // This is an infinite loop, should never be here fprintf (stderr, "gpsd2udp ERROR abnormal exit\n"); exit (-1); diff --git a/gpsclient.c b/gpsclient.c index f1053121..276900e3 100644 --- a/gpsclient.c +++ b/gpsclient.c @@ -84,7 +84,7 @@ PyDoc_STRVAR(module_doc, extern PyMODINIT_FUNC initclienthelpers(void); PyMODINIT_FUNC -// cppcheck-suppress unusedFunction +// cppcheck-suppress unusedFunction initclienthelpers(void) { PyObject *m; @@ -53,9 +53,9 @@ static void settle(struct gps_device_t *session) #endif /* defined(RECONFIGURE_ENABLE) || defined(CONTROLSEND_ENABLE) */ /* - * Allows any response other than ERROR. Use it for queries where a - * failure return (due to, for example, a missing driver method) is - * immediate, but successful responses have unpredictable lag. + * Allows any response other than ERROR. Use it for queries where a + * failure return (due to, for example, a missing driver method) is + * immediate, but successful responses have unpredictable lag. */ #define NON_ERROR 0 /* must be distinct from any gps_mask_t value */ @@ -446,7 +446,7 @@ int main(int argc, char **argv) /* if no control operation was specified, just ID the device */ if (speed==NULL && rate == NULL && !to_nmea && !to_binary && !reset) { - (void)printf("%s identified as a %s", + (void)printf("%s identified as a %s", gpsdata.dev.path, gpsdata.dev.driver); if (gpsdata.dev.subtype[0] != '\0') { (void)fputc(' ', stdout); @@ -476,7 +476,7 @@ int main(int argc, char **argv) * sent and will shortly take effect. */ if (to_nmea) { - if (!gps_query(&gpsdata, NON_ERROR, (int)timeout, + if (!gps_query(&gpsdata, NON_ERROR, (int)timeout, "?DEVICE={\"path\":\"%s\",\"native\":0}\r\n", device)) { gpsd_log(&context.errout, LOG_ERROR, @@ -600,9 +600,9 @@ int main(int argc, char **argv) fd_set rfds; /* - * Unless the user explicitly requested it, always run to end of + * Unless the user explicitly requested it, always run to end of * hunt rather than timing out. Otherwise we can easily get messages - * that spuriously look like failure at high baud rates. + * that spuriously look like failure at high baud rates. */ gps_context_init(&context, "gpsctl"); @@ -644,7 +644,7 @@ int main(int argc, char **argv) device); exit(EXIT_FAILURE); } - gpsd_log(&context.errout, LOG_INF, + gpsd_log(&context.errout, LOG_INF, "device %s activated\n", session.gpsdata.dev.path); FD_SET(session.gpsdata.gps_fd, &all_fds); if (session.gpsdata.gps_fd > maxfd) @@ -612,7 +612,7 @@ static ssize_t throttled_write(struct subscriber_t *sub, char *buf, "client(%d) timed out.\n", sub_index(sub)); else gpsd_log(&context.errout, LOG_INF, - "client(%d) write: %s\n", + "client(%d) write: %s\n", sub_index(sub), strerror(errno)); detach_client(sub); return status; @@ -700,13 +700,13 @@ static bool open_device( struct gps_device_t *device) * 1PPS derived time data to ntpd/chrony. */ ntpshm_link_activate(device); - gpsd_log(&context.errout, LOG_INF, + gpsd_log(&context.errout, LOG_INF, "PPS:%s ntpshm_link_activate: %d\n", device->gpsdata.dev.path, device->shm_clock != NULL); #endif /* NTPSHM_ENABLE */ - gpsd_log(&context.errout, LOG_INF, + gpsd_log(&context.errout, LOG_INF, "device %s activated\n", device->gpsdata.dev.path); if ( PLACEHOLDING_FD == activated ) { /* it is a /dev/ppsX, no need to select() it */ @@ -719,7 +719,7 @@ static bool open_device( struct gps_device_t *device) } bool gpsd_add_device(const char *device_name, bool flag_nowait) -/* add a device to the pool; open it right away if in nowait mode +/* add a device to the pool; open it right away if in nowait mode * return: false on failure * true on success */ @@ -973,7 +973,7 @@ static bool privileged_user(struct gps_device_t *device) /* * Yes, zero subscribers is possible. For example, gpsctl talking * to the daemon connects but doesn't necessarily issue a ?WATCH - * before shipping a request, which means it isn't marked as a + * before shipping a request, which means it isn't marked as a * subscriber. */ return subcount <= 1; @@ -1392,7 +1392,7 @@ static void pseudonmea_report(struct subscriber_t *sub, if ((changed & REPORT_IS) != 0) { nmea_tpv_dump(device, buf, sizeof(buf)); - gpsd_log(&context.errout, LOG_IO, + gpsd_log(&context.errout, LOG_IO, "<= GPS (binary tpv) %s: %s\n", device->gpsdata.dev.path, buf); (void)throttled_write(sub, buf, strlen(buf)); @@ -2001,7 +2001,7 @@ int main(int argc, char *argv[]) } /* * By initializing before we drop privileges, we guarantee that even - * hotplugged devices added *after* we drop privileges will be able + * hotplugged devices added *after* we drop privileges will be able * to use segments 0 and 1. */ (void)ntpshm_context_init(&context); diff --git a/gpsd_json.c b/gpsd_json.c index 4ea21ad8..22c9f3d2 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -324,7 +324,7 @@ void json_device_dump(const struct gps_device_t *device, */ if (device->gpsdata.online > 0) { str_appendf(reply, replylen, - "\"activated\":\"%s\",", + "\"activated\":\"%s\",", unix_to_iso8601(device->gpsdata.online, buf1, sizeof(buf1))); if (device->observed != 0) { int mask = 0; @@ -382,7 +382,7 @@ void json_subframe_dump(const struct gps_data_t *datap, { const struct subframe_t *subframe = &datap->subframe; const bool scaled = datap->policy.scaled; - + (void)snprintf(buf, buflen, "{\"class\":\"SUBFRAME\",\"device\":\"%s\"," "\"tSV\":%u,\"TOW17\":%u,\"frame\":%u,\"scaled\":%s", datap->dev.path, @@ -2108,7 +2108,7 @@ void json_aivdm_dump(const struct ais_t *ais, "\"data\":\"%zd:%s\"}\r\n", ais->type8.bitcount, json_stringify(buf1, sizeof(buf1), - gpsd_hexdump(scratchbuf, sizeof(scratchbuf), + gpsd_hexdump(scratchbuf, sizeof(scratchbuf), (char *)ais->type8.bitdata, BITS_TO_BYTES(ais->type8.bitcount)))); break; @@ -30,7 +30,7 @@ static int gpsd_control(char *action, char *argument) int status; (void)syslog(LOG_ERR, "gpsd_control(action=%s, arg=%s)", action, argument); - if (access(control_socket, F_OK) == 0 && + if (access(control_socket, F_OK) == 0 && (connect = netlib_localsocket(control_socket, SOCK_STREAM)) >= 0) syslog(LOG_INFO, "reached a running gpsd"); else if (strcmp(action, "add") == 0) { @@ -182,7 +182,7 @@ static void visibilize(char *buf2, size_t len2, const char *buf) } #endif /* PPS_ENABLE */ -static void cond_hexdump(char *buf2, size_t len2, +static void cond_hexdump(char *buf2, size_t len2, const char *buf, size_t len) /* pass through visibilized if all printable, hexdump otherwise */ { @@ -227,7 +227,7 @@ void toff_update(WINDOW *win, int y, int x) getmaxyx(win, ymax, xmax); assert(ymax > 0); /* squash a compiler warning */ (void)wmove(win, y, x); - /* + /* * The magic number shortening the field works because * we know we'll never see more than 5 digits of seconds * rather than 10. @@ -354,7 +354,7 @@ static void announce_log(const char *fmt, ...) va_start(ap, fmt); (void)vsnprintf(buf, sizeof(buf) - 5, fmt, ap); va_end(ap); - + if (packetwin != NULL) { report_lock(); (void)wattrset(packetwin, A_BOLD); @@ -709,7 +709,7 @@ static void complain(const char *fmt, ...) /***************************************************************************** * - * Main sequence + * Main sequence * *****************************************************************************/ @@ -772,7 +772,7 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED) timedelta_str); } - (void)snprintf(buf, sizeof(buf), + (void)snprintf(buf, sizeof(buf), "------------------- PPS offset: %.20s ------\n ", timedelta_str); /* @@ -839,7 +839,7 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED) } else if (device->newdata.time <= device->pps_thread.fix_in.real.tv_sec) { // "NTP: Not a new time #endif /* PPS_ENABLE */ - } else + } else ntp_latch(device, &time_offset); #endif /* NTP_ENABLE */ } @@ -885,7 +885,7 @@ static bool do_command(const char *line) /* *INDENT-ON* */ } else complain - ("Device type %s has no rate switcher", + ("Device type %s has no rate switcher", switcher->type_name); } #endif /* RECONFIGURE_ENABLE */ @@ -960,7 +960,7 @@ static bool do_command(const char *line) fallback = switcher; } else complain - ("Device type %s has no mode switcher", + ("Device type %s has no mode switcher", switcher->type_name); } break; @@ -1080,7 +1080,7 @@ static bool do_command(const char *line) if (st < 0) complain("Invalid hex string (error %d)", st); else if (session.device_type->control_send == NULL) - complain("Device type %s has no control-send method.", + complain("Device type %s has no control-send method.", session.device_type->type_name); else if (!monitor_control_send(buf, (size_t) st)) complain("Control send failed."); @@ -1262,12 +1262,12 @@ int main(int argc, char **argv) } if (serial) { - (void) strlcpy(session.gpsdata.dev.path, - source.device, + (void) strlcpy(session.gpsdata.dev.path, + source.device, sizeof(session.gpsdata.dev.path)); } else { if (strstr(source.server, "//") == 0) - (void) strlcpy(session.gpsdata.dev.path, + (void) strlcpy(session.gpsdata.dev.path, "tcp://", sizeof(session.gpsdata.dev.path)); else @@ -1347,7 +1347,7 @@ int main(int argc, char **argv) } else if (!curses_init()) goto quit; - for (;;) + for (;;) { fd_set efds; switch(gpsd_await_data(&rfds, &efds, maxfd, &all_fds, &context.errout)) diff --git a/gpspacket.c b/gpspacket.c index 05d8f961..06a41d36 100644 --- a/gpspacket.c +++ b/gpspacket.c @@ -256,7 +256,7 @@ level of the message and the message itself.\n\ extern PyMODINIT_FUNC initpacket(void); PyMODINIT_FUNC -// cppcheck-suppress unusedFunction +// cppcheck-suppress unusedFunction initpacket(void) { PyObject *m; @@ -336,13 +336,13 @@ int main(int argc, char **argv) switch( option_u ) { case 2: - (void)snprintf(tmstr_u, sizeof(tmstr_u), - " %ld.%06ld", + (void)snprintf(tmstr_u, sizeof(tmstr_u), + " %ld.%06ld", (long)now.tv_sec, (long)now.tv_nsec/1000); break; case 1: - (void)snprintf(tmstr_u, sizeof(tmstr_u), + (void)snprintf(tmstr_u, sizeof(tmstr_u), ".%06ld", (long)now.tv_nsec/1000); break; default: diff --git a/gpxlogger.c b/gpxlogger.c index 96037319..c442587f 100644 --- a/gpxlogger.c +++ b/gpxlogger.c @@ -266,7 +266,7 @@ int main(int argc, char **argv) minmove = (double )atoi(optarg); break; case 'V': - (void)fprintf(stderr, "%s: version %s (revision %s)\n", + (void)fprintf(stderr, "%s: version %s (revision %s)\n", progname, VERSION, REVISION); exit(EXIT_SUCCESS); default: |