summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2002-11-02 16:36:39 +0000
committerJelmer Vernooij <jelmer@samba.org>2002-11-02 16:36:39 +0000
commit25e9b03738f98a15e9143f080b1680c974e3acb8 (patch)
tree85a377347110a6800ef0066ebb862e84831d4edb /source3/smbd
parent8a6b05d36d460a1814e72f634835604f48f570d9 (diff)
downloadsamba-25e9b03738f98a15e9143f080b1680c974e3acb8.tar.gz
samba-25e9b03738f98a15e9143f080b1680c974e3acb8.tar.bz2
samba-25e9b03738f98a15e9143f080b1680c974e3acb8.zip
Convert to popt.
Removed -o and -a options - these have been broken since 2.2 without complaints from users (This used to be commit c8589a567b96dacc0b6c88c91b34f8211532bbfa)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/server.c98
1 files changed, 23 insertions, 75 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index ad00794bd7..f2299d797f 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -621,9 +621,7 @@ static void usage(char *pname)
d_printf("Usage: %s [-DaioPh?Vb] [-d debuglevel] [-l log basename] [-p port]\n", pname);
d_printf(" [-O socket options] [-s services file]\n");
d_printf("\t-D Become a daemon (default)\n");
- d_printf("\t-a Append to log file (default)\n");
d_printf("\t-i Run interactive (not a daemon)\n" );
- d_printf("\t-o Overwrite log file, don't append\n");
d_printf("\t-h Print usage\n");
d_printf("\t-? Print usage\n");
d_printf("\t-V Print version\n");
@@ -640,9 +638,8 @@ static void usage(char *pname)
main program.
****************************************************************************/
- int main(int argc,char *argv[])
+ int main(int argc,const char *argv[])
{
- extern BOOL append_log;
extern BOOL AllowDebugChange;
extern char *optarg;
/* shall I run as a daemon */
@@ -652,80 +649,38 @@ static void usage(char *pname)
char *ports = NULL;
int opt;
pstring logfile;
+ poptContext pc;
+
+ struct poptOption long_options[] = {
+ POPT_AUTOHELP
+ {"daemon", 'D', POPT_ARG_VAL, &is_daemon, True, "Become a daemon (default)" },
+ {"interactive", 'i', POPT_ARG_VAL, &interactive, True, "Run interactive (not a daemon)"},
+ {"build-options", 'b', POPT_ARG_NONE, NULL, 'b', "Print build options" },
+ {"port", 'p', POPT_ARG_STRING, ports, 0, "Listen on the specified ports"},
+ {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_socket_options},
+ {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_log_base},
+ {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version},
+ { NULL }
+ };
#ifdef HAVE_SET_AUTH_PARAMETERS
set_auth_parameters(argc,argv);
#endif
- /* this is for people who can't start the program correctly */
- while (argc > 1 && (*argv[1] != '-')) {
- argv++;
- argc--;
- }
-
- while ( EOF != (opt = getopt(argc, argv, "O:l:s:d:Dp:h?bVaiof:")) )
+ pc = poptGetContext("smbd", argc, argv, long_options, 0);
+
+ while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
- case 'O':
- pstrcpy(user_socket_options,optarg);
- break;
-
- case 's':
- pstrcpy(dyn_CONFIGFILE,optarg);
- break;
-
- case 'l':
- specified_logfile = True;
- pstr_sprintf(logfile, "%s/log.smbd", optarg);
- lp_set_logfile(logfile);
- break;
-
- case 'a':
- append_log = True;
- break;
-
- case 'i':
- interactive = True;
- break;
-
- case 'o':
- append_log = False;
- break;
-
- case 'D':
- is_daemon = True;
- break;
-
- case 'd':
- if (*optarg == 'A')
- DEBUGLEVEL = 10000;
- else
- DEBUGLEVEL = atoi(optarg);
- AllowDebugChange = False;
- break;
-
- case 'p':
- ports = optarg;
- break;
-
- case 'h':
- case '?':
- usage(argv[0]);
- exit(0);
- break;
-
- case 'V':
- d_printf("Version %s\n",VERSION);
- exit(0);
- break;
case 'b':
- build_options(True); /* Display output to screen as well as debug */
+ build_options(True); /* Display output to screen as well as debug */
exit(0);
break;
- default:
- DEBUG(0,("Incorrect program usage - are you sure the command line is correct?\n"));
- usage(argv[0]);
- exit(1);
}
+ }
+
+ poptFreeContext(pc);
#ifdef HAVE_SETLUID
/* needed for SecureWare on SCO */
@@ -736,13 +691,6 @@ static void usage(char *pname)
load_case_tables();
- append_log = True;
-
- if(!specified_logfile) {
- pstr_sprintf(logfile, "%s/log.smbd", dyn_LOGFILEBASE);
- lp_set_logfile(logfile);
- }
-
set_remote_machine_name("smbd");
setup_logging(argv[0],interactive);