]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2000-08-09 14:14:11 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Wed, 9 Aug 2000 14:14:11 +0000 (14:14 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Wed, 9 Aug 2000 14:14:11 +0000 (14:14 +0000)
new switch -F (do not fork)
added automatic forking if -F not specified

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@63 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

README
lcd4linux.c

diff --git a/README b/README
index 7e5312a3b24452c3987d4610a2d9918d8817ef89..2000a02e0ccca8d1c0d37745bfa61c8b8e4cd511 100644 (file)
--- 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
index 0d492020dda0592aeddd1bd07d857c8839d49c38..3236937205b78702469443fb0a35aace48d3703c 100644 (file)
@@ -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
  *
  *
  *
  * $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