1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
$NetBSD: patch-af,v 1.1.1.1 2003/10/05 09:16:17 cube Exp $
--- src/nvtvd.c.orig 2003-02-10 15:50:44.000000000 +0100
+++ src/nvtvd.c
@@ -27,6 +27,7 @@
#include "local.h" /* before everything else */
#include <stdio.h>
+#include <stdlib.h>
#include <getopt.h>
#ifdef HAVE_UNISTD_H
@@ -51,6 +52,7 @@ BackCardPtr back_card = NULL;
Bool opt_null = FALSE;
Bool opt_nvdev = FALSE;
+Bool opt_debug = FALSE;
static const char *short_options = "?hnN";
@@ -58,6 +60,7 @@ static struct option long_options[] =
{{"help", no_argument, NULL, 'h'},
{"null", no_argument, NULL, 'n'},
{"nvdev", no_argument, NULL, 'N'},
+ {"debug", no_argument, NULL, 'd'},
{NULL, 0, NULL, 0}
};
@@ -77,6 +80,8 @@ void usage (void)
" -N --nvdev enable usage of /dev/nv* devices\n");
fprintf (stderr,
" -n --null use null backend (for debugging)\n");
+ fprintf (stderr,
+ " -d --debug don't detach from controlling terminal\n");
}
/* -------- Server state -------- */
@@ -581,6 +586,9 @@ int main (int argc, char *argv[])
case 'N':
opt_nvdev = TRUE;
break;
+ case 'd':
+ opt_debug = TRUE;
+ break;
}
}
@@ -618,6 +626,8 @@ int main (int argc, char *argv[])
}
DPRINTF ("server loop.\n");
+ if (!opt_debug)
+ daemon(0,0);
srv_loop ();
fclose (pipe_in);
|