#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>
}
-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
}
}
-#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 )
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' ) {
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 );
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 ) {
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
[\c
.BR \-n ]
[\c
+.BR \-c ]
+[\c
.BR \-u ]
[\c
.BR \-v ]
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.