summaryrefslogtreecommitdiff
path: root/source3/torture/vfstest.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2003-04-14 21:16:16 +0000
committerJelmer Vernooij <jelmer@samba.org>2003-04-14 21:16:16 +0000
commit69980daceff7f1a0f399ef004b45ad9f209f1f62 (patch)
tree3290d55ab7c0c8a57cc42c7c8c7c60d8defed724 /source3/torture/vfstest.c
parentce31379577d5e713ab7214e46631bd260e653ea6 (diff)
downloadsamba-69980daceff7f1a0f399ef004b45ad9f209f1f62.tar.gz
samba-69980daceff7f1a0f399ef004b45ad9f209f1f62.tar.bz2
samba-69980daceff7f1a0f399ef004b45ad9f209f1f62.zip
Fix popt usage (backport from HEAD)
(This used to be commit 89a25ef20d10e20e70b11bba56add4708f62051f)
Diffstat (limited to 'source3/torture/vfstest.c')
-rw-r--r--source3/torture/vfstest.c44
1 files changed, 9 insertions, 35 deletions
diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c
index 04f31656d3..3b28a3c496 100644
--- a/source3/torture/vfstest.c
+++ b/source3/torture/vfstest.c
@@ -4,7 +4,7 @@
Copyright (C) Simo Sorce 2002
Copyright (C) Eric Lorimer 2002
- Copyright (C) Jelmer Vernooij 2002
+ Copyright (C) Jelmer Vernooij 2002,2003
Most of this code was ripped off of rpcclient.
Copyright (C) Tim Potter 2000-2001
@@ -474,17 +474,11 @@ BOOL reload_services(BOOL test)
int main(int argc, char *argv[])
{
- BOOL interactive = True;
- int opt;
- static char *cmdstr = "";
- static char *opt_logfile=NULL;
- static int opt_debuglevel;
- pstring logfile;
+ static char *cmdstr = NULL;
struct cmd_set **cmd_set;
- extern BOOL AllowDebugChange;
static struct vfs_state vfs;
int i;
- static const char *filename = "";
+ static const char *filename = NULL;
/* make sure the vars that get altered (4th field) are in
a fixed location or certain compilers complain */
@@ -493,35 +487,17 @@ int main(int argc, char *argv[])
POPT_AUTOHELP
{"file", 'f', POPT_ARG_STRING, &filename, 0, },
{"command", 'c', POPT_ARG_STRING, &cmdstr, 0, "Execute specified list of commands" },
- {"logfile", 'l', POPT_ARG_STRING, &opt_logfile, 'l', "Write output to specified logfile" },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version},
- { 0, 0, 0, 0}
+ POPT_COMMON_SAMBA
+ POPT_TABLEEND
};
setlinebuf(stdout);
- DEBUGLEVEL = 1;
- AllowDebugChange = False;
-
pc = poptGetContext("vfstest", argc, (const char **) argv,
long_options, 0);
- while((opt = poptGetNextOpt(pc)) != -1) {
- switch (opt) {
- case 'l':
- slprintf(logfile, sizeof(logfile) - 1, "%s.client",
- opt_logfile);
- lp_set_logfile(logfile);
- interactive = False;
- break;
-
- case 'd':
- DEBUGLEVEL = opt_debuglevel;
- break;
- }
- }
+ while(poptGetNextOpt(pc) != -1);
poptFreeContext(pc);
@@ -531,9 +507,7 @@ int main(int argc, char *argv[])
/* the following functions are part of the Samba debugging
facilities. See lib/debug.c */
- setup_logging("vfstest", interactive);
- if (!interactive)
- reopen_logs();
+ setup_logging("vfstest", True);
/* Load command lists */
@@ -556,13 +530,13 @@ int main(int argc, char *argv[])
smbd_vfs_init(vfs.conn);
/* Do we have a file input? */
- if (filename[0]) {
+ if (filename && filename[0]) {
process_file(&vfs, filename);
return 0;
}
/* Do anything specified with -c */
- if (cmdstr[0]) {
+ if (cmdstr && cmdstr[0]) {
char *cmd;
char *p = cmdstr;