aboutsummaryrefslogtreecommitdiffstats
path: root/lcd4linux.c
diff options
context:
space:
mode:
authorentropy <entropy@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-09-14 11:19:29 +0000
committerentropy <entropy@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-09-14 11:19:29 +0000
commitbebbbc7506b5edc95b0c7a891d4f4d04a09d635a (patch)
treeb1f3b275278d43806336293e7af50a1b772d66c5 /lcd4linux.c
parent0bcf2d3cb842f0cb2f1109b0448de3db2bde385d (diff)
downloadlcd4linux-bebbbc7506b5edc95b0c7a891d4f4d04a09d635a.tar.gz
[lcd4linux @ 2006-09-14 11:19:29 by entropy]
New cmdline option -p to specify the pidfile location git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@715 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'lcd4linux.c')
-rw-r--r--lcd4linux.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/lcd4linux.c b/lcd4linux.c
index bd9d231..c8b51b4 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.83 2006/09/14 03:49:14 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.84 2006/09/14 11:19:29 entropy Exp $
*
* LCD4Linux
*
@@ -23,6 +23,9 @@
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.84 2006/09/14 11:19:29 entropy
+ * New cmdline option -p to specify the pidfile location
+ *
* Revision 1.83 2006/09/14 03:49:14 reinelt
* indent run
*
@@ -425,7 +428,7 @@ static void usage(void)
printf("%s\n", copyright);
printf("usage: lcd4linux [-h]\n");
printf(" lcd4linux [-l]\n");
- printf(" lcd4linux [-c key=value] [-i] [-f config-file] [-v]\n");
+ printf(" lcd4linux [-c key=value] [-i] [-f config-file] [-v] [-p pid-file]\n");
printf(" lcd4linux [-c key=value] [-F] [-f config-file] [-o output-file] [-q] [-v]\n");
}
@@ -535,6 +538,7 @@ static void daemonize(void)
int main(int argc, char *argv[])
{
char *cfg = "/etc/lcd4linux.conf";
+ char *pidfile = PIDFILE;
char *display, *driver, *layout;
char section[32];
int c;
@@ -556,7 +560,7 @@ int main(int argc, char *argv[])
running_foreground = 0;
running_background = 0;
- while ((c = getopt(argc, argv, "c:Ff:hilo:qv")) != EOF) {
+ while ((c = getopt(argc, argv, "c:Ff:hilo:qvp:")) != EOF) {
switch (c) {
case 'c':
@@ -591,6 +595,9 @@ int main(int argc, char *argv[])
case 'v':
verbose_level++;
break;
+ case 'p':
+ pidfile = optarg;
+ break;
default:
exit(2);
}
@@ -642,7 +649,7 @@ int main(int argc, char *argv[])
signal(SIGQUIT, SIG_IGN);
/* create PID file */
- if ((pid = pid_init(PIDFILE)) != 0) {
+ if ((pid = pid_init(pidfile)) != 0) {
error("lcd4linux already running as process %d", pid);
exit(1);
}
@@ -654,7 +661,7 @@ int main(int argc, char *argv[])
/* go into interactive mode before display initialization */
if (interactive >= 2) {
interactive_mode();
- pid_exit(PIDFILE);
+ pid_exit(pidfile);
cfg_exit();
exit(0);
}
@@ -666,7 +673,7 @@ int main(int argc, char *argv[])
debug("initializing driver %s", driver);
if (drv_init(section, driver, quiet) == -1) {
- pid_exit(PIDFILE);
+ pid_exit(pidfile);
exit(1);
}
free(driver);
@@ -678,7 +685,7 @@ int main(int argc, char *argv[])
if (interactive >= 1) {
interactive_mode();
drv_quit(quiet);
- pid_exit(PIDFILE);
+ pid_exit(pidfile);
cfg_exit();
exit(0);
}
@@ -712,7 +719,7 @@ int main(int argc, char *argv[])
debug("leaving main loop");
drv_quit(quiet);
- pid_exit(PIDFILE);
+ pid_exit(pidfile);
cfg_exit();
plugin_exit();
timer_exit();