$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 +#include #include #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);