diff options
author | Chris Kuethe <chris.kuethe@gmail.com> | 2007-03-07 21:55:46 +0000 |
---|---|---|
committer | Chris Kuethe <chris.kuethe@gmail.com> | 2007-03-07 21:55:46 +0000 |
commit | 8b70e428a620d513429ff828ab6efd0977d21fee (patch) | |
tree | 3cc0822ba624f1ecd897e27e1c23a36df45971f8 /gpsd.c | |
parent | 8f51e391df081aaf384c1e07129ac1a373c829f3 (diff) | |
download | gpsd-8b70e428a620d513429ff828ab6efd0977d21fee.tar.gz |
Much as I hate to do this, add a command line flag (-b)...
...to prevent gpsd from writing to a device. It sucks that we have to
do this, but I'm really sick of explaining to people that gpsd is not
to blame for the crap being sold as a bluetooth device these days.
This is user-friendly and packager-friendly: users can now run gpsd on an
arbitrary device without fear of wrecking it, and packagers do not need to
produce special "--disable-reconfigure" packages.
In a perfect world
* embedded bluetooth stacks would not be flaky and fragile
* there would be a reliable, cross-platform way to detect a
bluetooth device, in order to optimize runtime behaviour.
I don't see either of these happening any time soon...
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -86,6 +86,7 @@ static fd_set all_fds; static int maxfd; static int debuglevel; static bool in_background = false; +extern bool readonly; static bool nowait = false; static jmp_buf restartbuf; /*@ -initallelements -nullassign -nullderef @*/ @@ -193,8 +194,9 @@ void gpsd_report(int errlevel, const char *fmt, ... ) static void usage(void) { - (void)printf("usage: gpsd [-n] [-N] [-D n] [-F sockfile] [-P pidfile] [-S port] [-h] device...\n\ + (void)printf("usage: gpsd [-b] [-n] [-N] [-D n] [-F sockfile] [-P pidfile] [-S port] [-h] device...\n\ Options include: \n\ + -b = bluetooth-safe: open data sources read-only\n\ -n = don't wait for client connects to poll GPS\n\ -N = don't go into background\n\ -F sockfile = specify control socket location\n\ @@ -1253,7 +1255,7 @@ int main(int argc, char *argv[]) setlocale(LC_NUMERIC, "C"); #endif debuglevel = 0; - while ((option = getopt(argc, argv, "F:D:S:dfhNnpP:V" + while ((option = getopt(argc, argv, "F:D:S:dfhNnpP:rV" #ifdef RTCM104_SERVICE "R:" #endif /* RTCM104_SERVICE */ @@ -1268,6 +1270,9 @@ int main(int argc, char *argv[]) case 'N': go_background = false; break; + case 'r': + readonly = true; + break; #ifdef RTCM104_SERVICE case 'R': rtcm_service = optarg; |