svn commit: trunk/busybox/coreutils

vda at busybox.net vda at busybox.net
Tue Jun 12 08:13:34 UTC 2007


Author: vda
Date: 2007-06-12 01:13:34 -0700 (Tue, 12 Jun 2007)
New Revision: 18799

Log:
catv: was abusing xopen, should not die on err, but warn only.


Modified:
   trunk/busybox/coreutils/catv.c


Changeset:
Modified: trunk/busybox/coreutils/catv.c
===================================================================
--- trunk/busybox/coreutils/catv.c	2007-06-12 08:12:33 UTC (rev 18798)
+++ trunk/busybox/coreutils/catv.c	2007-06-12 08:13:34 UTC (rev 18799)
@@ -23,14 +23,20 @@
 #define CATV_OPT_t (1<<1)
 #define CATV_OPT_v (1<<2)
 	flags ^= CATV_OPT_v;
+	argv += optind;
 
-	argv += optind;
+	/* Read from stdin if there's nothing else to do. */
+	fd = 0;
+	if (!argv[0])
+		goto jump_in;
 	do {
-		/* Read from stdin if there's nothing else to do. */
-		fd = 0;
-		if (*argv && 0 > (fd = xopen(*argv, O_RDONLY)))
+		fd = open_or_warn(*argv, O_RDONLY);
+		if (fd < 0) {
 			retval = EXIT_FAILURE;
-		else for (;;) {
+			continue;
+		}
+ jump_in:
+		for (;;) {
 			int i, res;
 
 #define read_buf bb_common_bufsiz1
@@ -46,10 +52,9 @@
 					if (c == 127) {
 						printf("^?");
 						continue;
-					} else {
-						printf("M-");
-						c -= 128;
 					}
+					printf("M-");
+					c -= 128;
 				}
 				if (c < 32) {
 					if (c == 10) {




More information about the busybox-cvs mailing list