summaryrefslogtreecommitdiff
path: root/source3/web
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2003-03-20 11:11:32 +0000
committerJelmer Vernooij <jelmer@samba.org>2003-03-20 11:11:32 +0000
commit4e01382b3a655a1bfef1a73ad486344b842bcdfc (patch)
treef425ef3a9672b2f1ebaf30b5ee995ce38eb204b8 /source3/web
parent573746991469eb41af71145301802fe06ab75f9e (diff)
downloadsamba-4e01382b3a655a1bfef1a73ad486344b842bcdfc.tar.gz
samba-4e01382b3a655a1bfef1a73ad486344b842bcdfc.tar.bz2
samba-4e01382b3a655a1bfef1a73ad486344b842bcdfc.zip
Make swat use popt
(This used to be commit 3cd1650d389850c2a36997a1a404d37bb28130e4)
Diffstat (limited to 'source3/web')
-rw-r--r--source3/web/swat.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/source3/web/swat.c b/source3/web/swat.c
index d6693b4e75..bece4e71e2 100644
--- a/source3/web/swat.c
+++ b/source3/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);