diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-07-30 09:59:12 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-07-30 09:59:12 +0000 |
commit | 898a6f772f083c2af44bd411955071b08dba8d97 (patch) | |
tree | 49456a0dd8f4a5cde2dd2acf2f6f578ddbb4ccc6 /sirfmon.c | |
parent | 89d51fe82003c0d922a2964366c6caec0da9d8d5 (diff) | |
download | gpsd-898a6f772f083c2af44bd411955071b08dba8d97.tar.gz |
Implement -F properly, and fix a bug reported by Wolfgang.
Diffstat (limited to 'sirfmon.c')
-rw-r--r-- | sirfmon.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -656,7 +656,7 @@ static int set_speed(unsigned int speed, unsigned int stopbits) } /*@ -charint @*/ } - + return NO_PACKET; } @@ -691,20 +691,18 @@ static unsigned int hunt_open(unsigned int *pstopbits) return 0; } -static int serial_initialize(char *device) +static void serial_initialize(char *device) { - if ((devicefd = open(device,O_RDWR)) < 0) { + if ((controlfd = devicefd = open(device,O_RDWR)) < 0) { perror(device); exit(1); } - + /* Save original terminal parameters */ if (tcgetattr(devicefd, &ttyset) != 0 || (bps = hunt_open(&stopbits))==0) { (void)fputs("Can't sync up with device!\n", stderr); exit(1); } - - return devicefd; } @@ -922,13 +920,16 @@ int main (int argc, char **argv) gmt_offset = (int)tzoffset(); - while ((option = getopt(argc, argv, "hvF:")) != -1) { + while ((option = getopt(argc, argv, "F:vh")) != -1) { switch (option) { + case 'F': + controlsock = optarg; + break; case 'v': (void)printf("sirfmon %s\n", VERSION); exit(0); case 'h': case '?': default: - (void)fputs("usage: sirfmon [-?hv] [server[:port:[device]]]\n", stderr); + (void)fputs("usage: sirfmon [-?hv] [-F controlsock] [server[:port:[device]]]\n", stderr); exit(1); } } @@ -979,8 +980,7 @@ int main (int argc, char **argv) /*@ +compdef @*/ serial = false; } else { - devicefd = serial_initialize(device = arg); - controlfd = dup(devicefd); + serial_initialize(device = arg); serial = true; } /*@ +boolops */ |