diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2003-03-20 11:16:14 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2003-03-20 11:16:14 +0000 |
commit | eccb6998111ce7a56bfd11578ccd7c09958f407e (patch) | |
tree | 5ac63f5fbc03fbea1b4bfaf02424ea361fbd7fa3 /source/web/swat.c | |
parent | 0308a0a11265050f53fc7e8e03f8e17b04adb45d (diff) | |
download | samba-eccb6998111ce7a56bfd11578ccd7c09958f407e.tar.gz samba-eccb6998111ce7a56bfd11578ccd7c09958f407e.tar.xz samba-eccb6998111ce7a56bfd11578ccd7c09958f407e.zip |
Make swat use popt
Diffstat (limited to 'source/web/swat.c')
-rw-r--r-- | source/web/swat.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/source/web/swat.c b/source/web/swat.c index d6693b4e750..bece4e71e2d 100644 --- a/source/web/swat.c +++ b/source/web/swat.c @@ -1261,10 +1261,16 @@ static void printers_page(void) **/ int main(int argc, char *argv[]) { - extern char *optarg; - extern int optind; int opt; char *page; + poptContext pc; + struct poptOption long_options[] = { + POPT_AUTOHELP + { "disable-authentication", 'a', POPT_ARG_VAL, &demo_mode, TRUE, "Disable authentication (demo mode)" }, + { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version}, + { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile}, + { 0, 0, 0, 0 } + }; fault_setup(NULL); umask(S_IWGRP | S_IWOTH); @@ -1288,16 +1294,13 @@ static void printers_page(void) close(2); open("/dev/null", O_WRONLY); - while ((opt = getopt(argc, argv,"s:a")) != EOF) { - switch (opt) { - case 's': - pstrcpy(dyn_CONFIGFILE,optarg); - break; - case 'a': - demo_mode = True; - break; - } - } + pc = poptGetContext("swat", argc, (const char **) argv, long_options, 0); + + /* Parse command line options */ + + while((opt = poptGetNextOpt(pc)) != -1) { } + + poptFreeContext(pc); setup_logging(argv[0],False); load_config(True); |