svn commit: samba r7743 - in branches/SAMBA_4_0/source/lib/ldb/tools: .

tridge at samba.org tridge at samba.org
Sun Jun 19 04:20:55 GMT 2005


Author: tridge
Date: 2005-06-19 04:20:54 +0000 (Sun, 19 Jun 2005)
New Revision: 7743

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7743

Log:
be consistent in how stdin is supported for ldbadd and ldbmodify

Modified:
   branches/SAMBA_4_0/source/lib/ldb/tools/ldbmodify.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/tools/ldbmodify.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/tools/ldbmodify.c	2005-06-19 04:20:27 UTC (rev 7742)
+++ branches/SAMBA_4_0/source/lib/ldb/tools/ldbmodify.c	2005-06-19 04:20:54 UTC (rev 7743)
@@ -101,26 +101,18 @@
 	options = ldb_cmdline_process(ldb, argc, argv, usage);
 
 	if (options->argc == 0) {
-		usage();
-		exit(1);
-	}
-
-	for (i=0;i<options->argc;i++) {
-		const char *fname = options->argv[i];
-		FILE *f;
-		if (strcmp(fname,"-") == 0) {
-			f = stdin;
-		} else {
+		count += process_file(ldb, stdin);
+	} else {
+		for (i=0;i<options->argc;i++) {
+			const char *fname = options->argv[i];
+			FILE *f;
 			f = fopen(fname, "r");
+			if (!f) {
+				perror(fname);
+				exit(1);
+			}
+			count += process_file(ldb, f);
 		}
-		if (!f) {
-			perror(fname);
-			exit(1);
-		}
-		count += process_file(ldb, f);
-		if (f != stdin) {
-			fclose(f);
-		}
 	}
 
 	talloc_free(ldb);



More information about the samba-cvs mailing list