[xiph-commits] r19100 - icecast/trunk/icecast/src

dm8tbr at svn.xiph.org dm8tbr at svn.xiph.org
Sat Mar 1 09:37:38 PST 2014


Author: dm8tbr
Date: 2014-03-01 09:37:38 -0800 (Sat, 01 Mar 2014)
New Revision: 19100

Modified:
   icecast/trunk/icecast/src/main.c
Log:
Reverting r18945 for now as using -b breaks things.

Reopening #1886


Modified: icecast/trunk/icecast/src/main.c
===================================================================
--- icecast/trunk/icecast/src/main.c	2014-03-01 16:38:15 UTC (rev 19099)
+++ icecast/trunk/icecast/src/main.c	2014-03-01 17:37:38 UTC (rev 19100)
@@ -3,11 +3,10 @@
  * This program is distributed under the GNU General Public License, version 2.
  * A copy of this license is included with this source.
  *
- * Copyright 2000-2013, Jack Moffitt <jack at xiph.org, 
+ * Copyright 2000-2004, Jack Moffitt <jack at xiph.org, 
  *                      Michael Smith <msmith at xiph.org>,
  *                      oddsock <oddsock at xiph.org>,
- *                      Karl Heyes <karl at xiph.org>,
- *                      Thomas B. Ruecker <thomas.ruecker at tieto.com>
+ *                      Karl Heyes <karl at xiph.org>
  *                      and others (see AUTHORS for details).
  * Copyright 2011-2012, Philipp "ph3-der-loewe" Schafft <lion at lion.leolix.org>,
  */
@@ -152,12 +151,31 @@
 
 static int _parse_config_opts(int argc, char **argv, char *filename, int size)
 {
-    int i;
+    int i = 1;
     int config_ok = 0;
 
+    background = 0;
     if (argc < 2) return -1;
 
-    for (i = 1; i < argc; i++) {
+    while (i < argc) {
+        if (strcmp(argv[i], "-b") == 0) {
+#ifndef WIN32
+            pid_t pid;
+            fprintf(stdout, "Starting icecast2\nDetaching from the console\n");
+
+            pid = fork();
+
+            if (pid > 0) {
+                /* exit the parent */
+                exit(0);
+            }
+            else if(pid < 0) {
+                fprintf(stderr, "FATAL: Unable to fork child!");
+                exit(1);
+            }
+            background = 1;
+#endif
+        }
         if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) {
             fprintf(stdout, "%s\n", ICECAST_VERSION_STRING);
             exit(0);
@@ -172,6 +190,7 @@
                 return -1;
             }
         }
+        i++;
     }
 
     if(config_ok)
@@ -180,34 +199,6 @@
         return -1;
 }
 
-static int _parse_config_opts_remaining(int argc, char **argv, char *filename, int size)
-{
-    int i;
-    background = 0;
-
-    for (i = 1; i < argc; i++) {
-        if (strcmp(argv[i], "-b") == 0) {
-#ifndef WIN32
-            pid_t pid;
-            fprintf(stdout, "Starting icecast2\nDetaching from the console\n");
-
-            pid = fork();
-
-            if (pid > 0) {
-                /* exit the parent */
-                exit(0);
-            }
-            else if(pid < 0) {
-                fprintf(stderr, "FATAL: Unable to fork child!");
-                exit(1);
-            }
-            background = 1;
-#endif
-        }
-    }
-    return 0;
-}
-
 static int _start_logging(void)
 {
     char fn_error[FILENAME_MAX];
@@ -510,9 +501,6 @@
         return 1;
     }
 
-    /* Delayed command line argument parsing, e.g. background */
-    _parse_config_opts_remaining(argc, argv, filename, 512);
-
     INFO1 ("%s server started", ICECAST_VERSION_STRING);
 
     /* REM 3D Graphics */



More information about the commits mailing list