diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2003-03-24 11:25:34 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2003-03-24 11:25:34 +0000 |
commit | 11e9de855ca84af8d34a5f6459f304fcfa72dca3 (patch) | |
tree | 0eb5d0505a50136ed74a4207219c42b9d4996402 /source3/torture | |
parent | 223828642548c7e25f6189e274aa1edcdfe30c4f (diff) | |
download | samba-11e9de855ca84af8d34a5f6459f304fcfa72dca3.tar.gz samba-11e9de855ca84af8d34a5f6459f304fcfa72dca3.tar.bz2 samba-11e9de855ca84af8d34a5f6459f304fcfa72dca3.zip |
Patch from metze to generalise POPT_COMMON_SAMBA, with some minor changes
(This used to be commit 2ddfed298d7f0b6e690275725a39c3ef107077ae)
Diffstat (limited to 'source3/torture')
-rw-r--r-- | source3/torture/samtest.c | 14 | ||||
-rw-r--r-- | source3/torture/vfstest.c | 44 |
2 files changed, 13 insertions, 45 deletions
diff --git a/source3/torture/samtest.c b/source3/torture/samtest.c index 0de2e5d288..fd5f75a664 100644 --- a/source3/torture/samtest.c +++ b/source3/torture/samtest.c @@ -353,10 +353,7 @@ int main(int argc, char *argv[]) { BOOL interactive = True; int opt; - static char *cmdstr = ""; - static char *opt_logfile=NULL; - static char *config_file = dyn_CONFIGFILE; - pstring logfile; + static char *cmdstr = NULL; struct cmd_set **cmd_set; struct samtest_state st; @@ -365,12 +362,9 @@ int main(int argc, char *argv[]) poptContext pc; struct poptOption long_options[] = { POPT_AUTOHELP - { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug }, {"command", 'e', POPT_ARG_STRING, &cmdstr, 'e', "Execute semicolon seperated cmds"}, - {"logfile", 'l', POPT_ARG_STRING, &opt_logfile, 'l', "Logfile to use instead of stdout"}, - {"configfile", 'c', POPT_ARG_STRING, &config_file, 0,"use different configuration file",NULL}, - { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version}, - { 0, 0, 0, 0} + POPT_COMMON_SAMBA + POPT_TABLEEND }; ZERO_STRUCT(st); @@ -419,7 +413,7 @@ int main(int argc, char *argv[]) } /* Do anything specified with -c */ - if (cmdstr[0]) { + if (cmdstr && cmdstr[0]) { char *cmd; char *p = cmdstr; 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; |