metze's autogenerate patch for version.h
[sfrench/samba-autobuild/.git] / source3 / wrepld / server.c
index 5203d337457daf1eb0d0b718a15651bf7dedd066..25de680982ce8722775c0feeeb70b68a53ca8dfb 100644 (file)
@@ -159,15 +159,6 @@ void exit_server(const char *reason)
        exit(0);
 }
 
-/****************************************************************************
- Usage of the program.
-****************************************************************************/
-
-static void usage(char *pname)
-{
-
-}
-
 /****************************************************************************
   Create an fd_set containing all the sockets in the subnet structures,
   plus the broadcast sockets.
@@ -510,17 +501,13 @@ static void process(void)
        static BOOL log_stdout = False;
        struct poptOption long_options[] = {
                POPT_AUTOHELP
-               POPT_COMMON_SAMBA
-               { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_socket_options },
-               { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
-               { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile },
-               { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_log_base },
                { "daemon", 'D', POPT_ARG_VAL, &is_daemon, True, "Become a daemon (default)" },
                { "foreground", 'F', POPT_ARG_VAL, &Fork, False, "Run daemon in foreground (for daemontools, etc)" },
                { "stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout" },
                { "interactive", 'i', POPT_ARG_NONE, NULL, 'i', "Run interactive (not a daemon)" },
                { "port", 'p', POPT_ARG_INT, &wins_port, 'p', "Listen on the specified port" },
-               { 0, 0, 0, 0 }
+               POPT_COMMON_SAMBA
+               POPT_TABLEEND
        };
        int opt;
        poptContext pc;
@@ -542,11 +529,10 @@ static void process(void)
                }
        }
 
-       poptFreeContext(pc);
 
        if (log_stdout && Fork) {
                d_printf("Can't log to stdout (-S) unless daemon is in foreground (-F) or interactive (-i)\n");
-               usage(argv[0]);
+               poptPrintUsage(pc, stderr, 0);
                exit(1);
        }
 
@@ -600,7 +586,7 @@ static void process(void)
 
        reopen_logs();
 
-       DEBUG(1,( "wrepld version %s started.\n", VERSION));
+       DEBUG(1,( "wrepld version %s started.\n", SAMBA_VERSION_STRING));
        DEBUGADD(1,( "Copyright Andrew Tridgell and the Samba Team 1992-2002\n"));
 
        DEBUG(2,("uid=%d gid=%d euid=%d egid=%d\n",
@@ -674,6 +660,7 @@ static void process(void)
 
        process();
 
+       poptFreeContext(pc);
        exit_server("normal exit");
        return(0);
 }