aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README9
-rw-r--r--lcd4linux.c43
2 files changed, 41 insertions, 11 deletions
diff --git a/README b/README
index 7e5312a..2000a02 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
#
-# $Id: README,v 1.7 2000/08/09 09:50:29 reinelt Exp $
+# $Id: README,v 1.8 2000/08/09 14:14:11 reinelt Exp $
#
This is the README file for lcd4linux
@@ -25,13 +25,14 @@ list available drivers
lcd4linux -d
calibrate delay loop (necessary for some drivers)
-lcd4linux [-c key=val] [-f config-file] [-o output] [-q] [-v]
+lcd4linux [-c key=val] [-F] [-f config-file] [-o output] [-q] [-v]
run lcd4linux
-generate debugging messages with '-v'
+overwrite entries from the config-file with '-c'
+do not fork and detach with '-F'
use configuration from 'config-file' instead of /etc/lcd4linux.conf
write picture to 'output' (raster driver only)
-overwrite entries from the config-file with '-c'
suppress startup splash screen with '-q'
+generate debugging messages with '-v' (implies -F)
SUPPORTED DISPLAYS
diff --git a/lcd4linux.c b/lcd4linux.c
index 0d49202..3236937 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.24 2000/08/09 09:50:29 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.25 2000/08/09 14:14:11 reinelt Exp $
*
* LCD4Linux
*
@@ -20,6 +20,11 @@
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.25 2000/08/09 14:14:11 reinelt
+ *
+ * new switch -F (do not fork)
+ * added automatic forking if -F not specified
+ *
* Revision 1.24 2000/08/09 09:50:29 reinelt
*
* opened 0.98 development
@@ -163,7 +168,7 @@ static void usage(void)
printf ("usage: lcd4linux [-h]\n");
printf (" lcd4linux [-l]\n");
printf (" lcd4linux [-d]\n");
- printf (" lcd4linux [-c key=value] [-f config-file] [-o output-file] [-q] [-v]\n");
+ printf (" lcd4linux [-c key=value] [-F] [-f config-file] [-o output-file] [-q] [-v]\n");
}
int hello (void)
@@ -229,9 +234,10 @@ int main (int argc, char *argv[])
char *cfg="/etc/lcd4linux.conf";
char *driver;
int c, smooth;
+ int foreground=0;
int quiet=0;
-
- while ((c=getopt (argc, argv, "c:df:hlo:qv"))!=EOF) {
+
+ while ((c=getopt (argc, argv, "c:dFf:hlo:qv"))!=EOF) {
switch (c) {
case 'c':
if (cfg_cmd (optarg)<0) {
@@ -242,6 +248,12 @@ int main (int argc, char *argv[])
case 'd':
calibrate();
exit(0);
+ case 'F':
+ foreground++;
+ break;
+ case 'f':
+ cfg=optarg;
+ break;
case 'h':
usage();
exit(0);
@@ -249,9 +261,6 @@ int main (int argc, char *argv[])
printf ("%s\n", release);
lcd_list();
exit(0);
- case 'f':
- cfg=optarg;
- break;
case 'o':
output=optarg;
break;
@@ -260,6 +269,7 @@ int main (int argc, char *argv[])
break;
case 'v':
debugging++;
+ foreground++;
break;
default:
exit(2);
@@ -271,6 +281,25 @@ int main (int argc, char *argv[])
exit(2);
}
+ if (!foreground) {
+ pid_t i;
+ // debugging does not make sense here
+ // because -v implies -F which sets foreground=1
+ // debug ("going background...\n");
+ i=fork();
+ if (i<0) {
+ perror ("fork() failed");
+ exit (1);
+ }
+ printf ("fork() returned %d\n", i);
+ if (i!=0)
+ exit (0);
+ close (0);
+ close (1);
+ printf ("Hallo stdout\n");
+ fprintf (stderr, "Hallo stderr\n");
+ }
+
debug ("LCD4Linux " VERSION "\n");
// set default values