[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] [PATCH 2/3] Enable Windows version of gpxlogger
From: |
Robert Norris |
Subject: |
[gpsd-dev] [PATCH 2/3] Enable Windows version of gpxlogger |
Date: |
Fri, 24 Feb 2017 22:55:15 +0000 |
Disable daemonize option which is not available on Windows.
Add check for signal compatibility as SIGQUIT may not be available.
TESTED:
Confirmed gpxlogger for Windows builds under a cross compiler.
Runs on a Windows system, connects to an instance of gpsd and produces a
GPX file from the gpsd output.
gpxlogger still builds, runs on Linux including the daemon option
---
gpxlogger.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/gpxlogger.c b/gpxlogger.c
index e34c2132..5c8b4a83 100644
--- a/gpxlogger.c
+++ b/gpxlogger.c
@@ -186,7 +186,10 @@ static void quit_handler(int signum)
static void usage(void)
{
(void)fprintf(stderr,
- "Usage: %s [-V] [-h] [-l] [-d] [-D debuglevel]"
+ "Usage: %s [-V] [-h] [-l] [-D debuglevel]"
+#ifdef HAVE_FORK
+ " [-d]"
+#endif /* HAVE_FORK */
" [-i timeout] [-f filename] [-m minmove]\n"
"\t[-r] [-e exportmethod] [server[:port:[device]]]\n\n"
"defaults to '%s -i 5 -e %s localhost:2947'\n",
@@ -214,10 +217,12 @@ int main(int argc, char **argv)
logfile = stdout;
while ((ch = getopt(argc, argv, "dD:e:f:hi:lm:rV")) != -1) {
switch (ch) {
+#ifdef HAVE_FORK
case 'd':
openlog(basename(progname), LOG_PID | LOG_PERROR, LOG_DAEMON);
daemonize = true;
break;
+#endif /* HAVE_FORK */
#ifdef CLIENTDEBUG_ENABLE
case 'D':
debug = atoi(optarg);
@@ -317,7 +322,9 @@ int main(int argc, char **argv)
/* catch all interesting signals */
(void)signal(SIGTERM, quit_handler);
+#ifdef SIGQUIT
(void)signal(SIGQUIT, quit_handler);
+#endif
(void)signal(SIGINT, quit_handler);
/* might be time to daemonize */
--
2.11.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gpsd-dev] [PATCH 2/3] Enable Windows version of gpxlogger,
Robert Norris <=