summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2003-03-20 11:16:14 +0000
committerJelmer Vernooij <jelmer@samba.org>2003-03-20 11:16:14 +0000
commitf46edac4bf1946ae4b2cb5ee6c07e8485d4f79e7 (patch)
tree2ae5eb66dbe3d2b30e146f226dccf7771208ecec /source3
parent873e090be37a3128f73d87988c2981dbfcee6601 (diff)
downloadsamba-f46edac4bf1946ae4b2cb5ee6c07e8485d4f79e7.tar.gz
samba-f46edac4bf1946ae4b2cb5ee6c07e8485d4f79e7.tar.bz2
samba-f46edac4bf1946ae4b2cb5ee6c07e8485d4f79e7.zip
Make swat use popt
(This used to be commit eccb6998111ce7a56bfd11578ccd7c09958f407e)
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in11
-rw-r--r--source3/web/swat.c27
2 files changed, 20 insertions, 18 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index fc2e8fe821..1f04a60528 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -2,7 +2,7 @@
# Makefile.in for Samba - rewritten for autoconf support
# Copyright Andrew Tridgell 1992-1998
# Copyright (C) 2001 by Martin Pool <mbp@samba.org>
-# Copyright Andrew Barteltt 2002
+# Copyright Andrew Bartlett 2002
# Copyright (C) 2003 Anthony Liguori <aliguor@us.ibm.com>
###########################################################################
@@ -290,8 +290,6 @@ PDB_MYSQL_OBJ = passdb/pdb_mysql.o
GROUPDB_OBJ = groupdb/mapping.o
-# passdb/smbpass.o passdb/ldap.o passdb/nispass.o
-
PROFILE_OBJ = profile/profile.o
OPLOCK_OBJ = smbd/oplock.o smbd/oplock_irix.o smbd/oplock_linux.o
@@ -375,7 +373,8 @@ SWAT_OBJ1 = web/cgi.o web/diagnose.o web/startstop.o web/statuspage.o \
SWAT_OBJ = $(SWAT_OBJ1) $(PRINTING_OBJ) $(LIBSMB_OBJ) $(LOCKING_OBJ) \
$(PARAM_OBJ) $(PASSDB_OBJ) $(SECRETS_OBJ) $(KRBCLIENT_OBJ) \
- $(UBIQX_OBJ) $(LIB_OBJ) $(GROUPDB_OBJ) $(PLAINTEXT_AUTH_OBJ)
+ $(UBIQX_OBJ) $(LIB_OBJ) $(GROUPDB_OBJ) $(PLAINTEXT_AUTH_OBJ) \
+ $(POPT_LIB_OBJ)
SMBSH_OBJ = smbwrapper/smbsh.o smbwrapper/shared.o \
$(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
@@ -717,10 +716,10 @@ bin/wrepld@EXEEXT@: $(WREPL_OBJ) bin/.dummy
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(WREPL_OBJ) $(LDFLAGS) $(LIBS)
-bin/swat@EXEEXT@: $(SWAT_OBJ) bin/.dummy
+bin/swat@EXEEXT@: $(SWAT_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LDFLAGS) $(DYNEXP) $(PRINTLIBS) \
- $(AUTHLIBS) $(LIBS)
+ $(AUTHLIBS) $(LIBS) @BUILD_POPT@
bin/rpcclient@EXEEXT@: $(RPCCLIENT_OBJ) @BUILD_POPT@ bin/.dummy
@echo Linking $@
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);