Only in webfs-0.9-drt: README.drt diff -u -r webfs-0.9/main.c webfs-0.9-drt/main.c --- webfs-0.9/main.c Sat Dec 25 16:49:23 1999 +++ webfs-0.9-drt/main.c Mon Mar 13 11:56:21 2000 @@ -27,6 +27,7 @@ char *server_name = "webfs/0.9"; int debug = 0; +int dontdetach = 0; int timeout = 60; int keepalive_time = 5; int tcp_port = 8000; @@ -42,7 +43,7 @@ FILE *log = NULL; int flushlog = 0; int usesyslog = 0; -int max_conn = 32; +int max_conn = 32; time_t now; int slisten; @@ -108,6 +109,7 @@ "Options:\n" " -h print this text\n" " -d enable debug output [%s]\n" + " -F do not fork into background [%s]\n" " -s enable syslog (start/stop/errors) [%s]\n" " -t sec set network timeout [%i]\n" " -c n set max. allowed connections [%i]\n" @@ -124,7 +126,8 @@ " -L log same as above + flush every line\n" " -m file read mime types from >file< [%s]\n", h ? h+1 : name, - debug ? "on" : "off", + debug ? "on" : "off", + dontdetach ? "on" : "off", usesyslog ? "on" : "off", timeout, max_conn, max_dircache, #ifdef USE_THREADS @@ -267,6 +270,13 @@ perror(txt); if (LOG_INFO == loglevel && usesyslog < 2) return; + if (dontdetach) { + if (NULL == peer) + printf("%s: %s\n",txt,strerror(errno)); + else + printf("%s: %s (peer=%s:%d)\n",txt,strerror(errno), + inet_ntoa(peer->sin_addr),ntohs(peer->sin_port)); + } if (usesyslog) { if (NULL == peer) syslog(loglevel,"%s: %s\n",txt,strerror(errno)); @@ -283,13 +293,20 @@ fprintf(stderr,"%s\n",txt); if (LOG_INFO == loglevel && usesyslog < 2) return; + if (dontdetach) { + if (NULL == peer) + printf("%s\n",txt); + else + printf("%s (peer=%s:%d)\n",txt, + inet_ntoa(peer->sin_addr),ntohs(peer->sin_port)); + } if (usesyslog) { if (NULL == peer) syslog(loglevel,"%s\n",txt); else syslog(loglevel,"%s (peer=%s:%d)\n",txt, inet_ntoa(peer->sin_addr),ntohs(peer->sin_port)); - } + } } /* ---------------------------------------------------------------------- */ @@ -538,7 +555,7 @@ /* parse options */ for (;;) { - if (-1 == (c = getopt(argc, argv, "hsdr:f:p:n:i:t:c:a:u:g:l:L:m:y:"))) + if (-1 == (c = getopt(argc, argv, "hsdFr:f:p:n:i:t:c:a:u:g:l:L:m:y:"))) break; switch (c) { case 'h': @@ -550,6 +567,9 @@ case 'd': debug++; break; + case 'F': + dontdetach++; + break; case 'r': doc_root = optarg; break; @@ -646,7 +666,7 @@ server_host,listen_ip,tcp_port,doc_root,user,group); /* run as daemon - detach from terminal */ - if (!debug) { + if ((!debug) && (!dontdetach)) { switch (fork()) { case -1: xperror(LOG_ERR,"fork",NULL); Only in webfs-0.9-drt: webfsd