[BusyBox] bb v0.47 wc patch

robotti at metconnect.com robotti at metconnect.com
Mon Oct 9 10:07:46 UTC 2000


Package: busybox
Version: 0.47

The line:

wc nonexistfile

acts thus:

# wc nonexistfile
wc: nonexistfile#

(both '#' are shell prompts...)

That seems to be fixed in the latest cvs bb, this
is just for bb v0.47.

--- wc.c.orig	Mon Sep 25 21:42:28 2000
+++ wc.c	Wed Sep 27 04:54:17 2000
@@ -134,13 +134,10 @@
 
 	if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) {
 		wc_file(stdin, "");
-		exit(TRUE);
+		return EXIT_SUCCESS;
 	} else {
 		while (optind < argc) {
-			file = fopen(argv[optind], "r");
-			if (file == NULL) {
-				fatalError(argv[optind]);
-			}
+			file = xfopen(argv[optind], "r");
 			wc_file(file, argv[optind]);
 			num_files_counted++;
 			optind++;
@@ -151,5 +148,5 @@
 		print_counts(total_lines, total_words, total_chars,
 					 max_length, "total");
 
-	return 0 ;
+	return EXIT_SUCCESS;
 }





More information about the busybox mailing list