]> git.sur5r.net Git - openldap/commitdiff
Import ITS#1071 -c fix
authorKurt Zeilenga <kurt@openldap.org>
Fri, 31 Aug 2001 01:53:16 +0000 (01:53 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 31 Aug 2001 01:53:16 +0000 (01:53 +0000)
clients/tools/ldapdelete.c

index 7aee669ce2efe1569a88a3349161289204d9a796..57a1444b70eceba2f785074f4f39bfdcb2afeb10 100644 (file)
@@ -626,18 +626,23 @@ main( int argc, char **argv )
        }
 
        rc = 0;
+
     if ( fp == NULL ) {
-       for ( ; optind < argc; ++optind ) {
-           rc = dodelete( ld, argv[ optind ] );
-       }
-    } else {
-       while ((rc == 0 || contoper) && fgets(buf, sizeof(buf), fp) != NULL) {
-           buf[ strlen( buf ) - 1 ] = '\0';    /* remove trailing newline */
-           if ( *buf != '\0' ) {
-               rc = dodelete( ld, buf );
-           }
+               for ( ; optind < argc; ++optind ) {
+                       rc = dodelete( ld, argv[ optind ] );
+
+                       /* Stop on error and no -c option */
+                       if( rc != 0 && contoper == 0) break;
+               }
+       } else {
+               while ((rc == 0 || contoper) && fgets(buf, sizeof(buf), fp) != NULL) {
+                       buf[ strlen( buf ) - 1 ] = '\0'; /* remove trailing newline */
+
+                       if ( *buf != '\0' ) {
+                               rc = dodelete( ld, buf );
+                       }
+               }
        }
-    }
 
     ldap_unbind( ld );