diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c
index 9345c77c253d5f8ab813c9c68deafff86a187528..2de87f9d766e64990cf4ea895a33000ee333319e 100644
--- a/clients/tools/ldapsearch.c
+++ b/clients/tools/ldapsearch.c
@@ -48,9 +48,7 @@
 #include <ac/errno.h>
 #include <sys/stat.h>
 
-#if defined(TEST_ABANDON) || defined(TEST_CANCEL)
 #include <ac/signal.h>
-#endif
 
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
@@ -234,7 +232,7 @@ urlize(char *url)
 }
 
 
-const char options[] = "a:Ab:E:F:l:Ls:S:tT:uz:"
+const char options[] = "a:Ab:cE:F:l:Ls:S:tT:uz:"
 	"Cd:D:e:f:h:H:IkKMnO:p:P:QR:U:vVw:WxX:y:Y:Z";
 
 int
@@ -555,15 +553,13 @@ private_conn_setup( LDAP *ld )
 	}
 }
 
-#if defined(TEST_ABANDON) || defined(TEST_CANCEL)
 static int gotintr;
 
 RETSIGTYPE
 do_sig( int sig )
 {
-	gotintr = 1;
+	gotintr = contoper;
 }
-#endif
 
 int
 main( int argc, char **argv )
@@ -623,9 +619,9 @@ main( int argc, char **argv )
 		attrs = &argv[optind];
 	}
 
-#if defined(TEST_ABANDON) || defined(TEST_CANCEL)
-	SIGNAL( SIGINT, do_sig );
-#endif
+	if ( contoper > 0 ) {
+		SIGNAL( SIGINT, do_sig );
+	}
 
 	if ( infile != NULL ) {
 		if ( infile[0] == '-' && infile[1] == '\0' ) {
@@ -1022,6 +1018,20 @@ static int dosearch(
 		sortattr ? LDAP_MSG_ALL : LDAP_MSG_ONE,
 		NULL, &res )) > 0 )
 	{
+		switch ( gotintr ) {
+		case 2:
+			rc = ldap_cancel_s( ld, msgid, NULL, NULL );
+			fprintf( stderr, "got interrupt, cancel got %d: %s\n",
+					rc, ldap_err2string( rc ) );
+			return -1;
+
+		case 1:
+			rc = ldap_abandon( ld, msgid );
+			fprintf( stderr, "got interrupt, abandon got %d: %s\n",
+					rc, ldap_err2string( rc ) );
+			return -1;
+		}
+
 		if( sortattr ) {
 			(void) ldap_sort_entries( ld, &res,
 				( *sortattr == '\0' ) ? NULL : sortattr, strcasecmp );
@@ -1118,27 +1128,13 @@ static int dosearch(
 
 		ldap_msgfree( res );
 	}
-#if defined(TEST_ABANDON) || defined(TEST_CANCEL)
-	if ( gotintr ) {
-#ifdef TEST_CANCEL
-		rc = ldap_cancel_s( ld, msgid, NULL, NULL );
-		fprintf( stderr, "got interrupt, cancel got %d\n", rc );
-		return -1;
-#endif
-#ifdef TEST_ABANDON
-		rc = ldap_abandon( ld, msgid );
-		fprintf( stderr, "got interrupt, abandon got %d\n", rc );
-		return -1;
-#endif
-	}
-#endif
 
+done:
 	if ( rc == -1 ) {
 		ldap_perror( ld, "ldap_result" );
 		return( rc );
 	}
 
-done:
 	ldap_msgfree( res );
 #ifdef LDAP_CONTROL_PAGEDRESULTS
 	if ( pagedResults ) { 
diff --git a/doc/devel/args b/doc/devel/args
index a9dd91ebf7fe6e3e23f15bde33df568130acd581..5c637fc85eb0275e9649a393c86cfb4ec44c1c7f 100644
--- a/doc/devel/args
+++ b/doc/devel/args
@@ -1,11 +1,11 @@
 Tools           ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-ldapcompare		 * DE**HI*K M*OPQR  UVWXYZ   de *h**k *n*p*    vwxyz
+ldapcompare      * DE**HI*K M*OPQR  UVWXYZ   de *h**k *n*p*    vwxyz
 ldapdelete       *CDE**HI*K M*OPQR  UVWXYZ  cdef*h**k *n*p*    vwxy
 ldapmodify       *CDE**HI*K M*OPQRS UVWXYZabcde *h**k *n*p*r t vwxy
 ldapmodrdn       *CDE**HI*K M*OPQR  UVWXYZ  cdef*h**k *n*p*rs  vwxy
 ldappasswd      A*CDE**HI*   *O QRS UVWXYZa  def*h**  * * * s  vwxy  
-ldapsearch      A*CDE**HI*KLM*OPQRSTUVWXYZab*def*h**kl*n*p* stuvwxyz
-ldapwhoami		 * DE**HI*   *O QR  UVWXYZ   def*h**  *n*p*    vwxy 
+ldapsearch      A*CDE**HI*KLM*OPQRSTUVWXYZabcdef*h**kl*n*p* stuvwxyz
+ldapwhoami       * DE**HI*   *O QR  UVWXYZ   def*h**  *n*p*    vwxy 
 
 
 * reserved
diff --git a/doc/man/man1/ldapsearch.1 b/doc/man/man1/ldapsearch.1
index cdb952bb675f67c8c96eed848494bc05501fee33..1086110b01c2337b7fb485eed0ea87b33becabf7 100644
--- a/doc/man/man1/ldapsearch.1
+++ b/doc/man/man1/ldapsearch.1
@@ -9,6 +9,8 @@ ldapsearch \- LDAP search tool
 [\c
 .BR \-n ]
 [\c
+.BR \-c ]
+[\c
 .BR \-u ]
 [\c
 .BR \-v ]
@@ -99,6 +101,13 @@ If no \fIattrs\fP are listed, all user attributes are returned.  If only
 Show what would be done, but don't actually perform the search.  Useful for
 debugging in conjunction with -v.
 .TP
+.B \-c
+Trap SIGINT and issue an
+.B abandon
+operation (if the switch appears once), or a
+.B cancel 
+extended operation (if the switch appears twice).
+.TP
 .B \-u
 Include the User Friendly Name form of the Distinguished Name (DN)
 in the output.