From 5e5b061719492c2ea14eabc1990b903cb99189b2 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 28 Aug 2010 21:38:47 +0000 Subject: [PATCH] allow to use 'swamp' from slapd-tester --- tests/progs/slapd-tester.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/progs/slapd-tester.c b/tests/progs/slapd-tester.c index 382a224c74..1b49c5433d 100644 --- a/tests/progs/slapd-tester.c +++ b/tests/progs/slapd-tester.c @@ -139,6 +139,8 @@ main( int argc, char **argv ) int sanum; int sextra_args = 0; char scmd[MAXPATHLEN]; + int swamp = 0; + char swampopt[sizeof("-SSS")]; /* static so that its address can be used in initializer below. */ static char sloops[LDAP_PVT_INTTYPE_CHARS(unsigned long)]; /* read */ @@ -209,7 +211,7 @@ main( int argc, char **argv ) mloops[0] = '\0'; bloops[0] = '\0'; - while ( ( i = getopt( argc, argv, "AB:CD:d:FH:h:Ii:j:L:l:NP:p:r:t:Ww:y:" ) ) != EOF ) + while ( ( i = getopt( argc, argv, "AB:CD:d:FH:h:Ii:j:L:l:NP:p:r:St:Ww:y:" ) ) != EOF ) { switch ( i ) { case 'A': @@ -336,6 +338,10 @@ main( int argc, char **argv ) retries = strdup( optarg ); break; + case 'S': + swamp++; + break; + case 't': /* the delay in seconds between each retry */ delay = strdup( optarg ); break; @@ -544,6 +550,13 @@ main( int argc, char **argv ) sargs[sanum++] = "-i"; sargs[sanum++] = ignore; } + if ( swamp ) { + swampopt[0] = '-'; + if ( swamp > 3 ) swamp = 3; + swampopt[swamp + 1] = '\0'; + for ( ; swamp-- > 0; ) swampopt[swamp + 1] = 'S'; + sargs[sanum++] = swampopt; + } sargs[sanum++] = "-b"; sargs[sanum++] = NULL; /* will hold the search base */ sargs[sanum++] = "-s"; -- 2.39.5