Module Name:    src
Committed By:   dholland
Date:           Sun Aug 11 00:12:47 UTC 2013

Modified Files:
        src/usr.bin/tr: tr.c

Log Message:
apply some CSE


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/tr/tr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.13 src/usr.bin/tr/tr.c:1.14
--- src/usr.bin/tr/tr.c:1.13	Sun Aug 11 00:11:46 2013
+++ src/usr.bin/tr/tr.c	Sun Aug 11 00:12:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.13 2013/08/11 00:11:46 dholland Exp $	*/
+/*	$NetBSD: tr.c,v 1.14 2013/08/11 00:12:47 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)tr.c	8.2 (Berkeley) 5/4/95";
 #endif
-__RCSID("$NetBSD: tr.c,v 1.13 2013/08/11 00:11:46 dholland Exp $");
+__RCSID("$NetBSD: tr.c,v 1.14 2013/08/11 00:12:47 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -209,17 +209,13 @@ main(int argc, char **argv)
 		errx(1, "empty string2");
 
 	/* If string2 runs out of characters, use the last one specified. */
-	if (sflag)
-		while (next(s1, &ch)) {
-			string1[ch] = ch2;
+	while (next(s1, &ch)) {
+		string1[ch] = ch2;
+		if (sflag) {
 			string2[ch2] = 1;
-			(void)next(s2, &ch2);
-		}
-	else
-		while (next(s1, &ch)) {
-			string1[ch] = ch2;
-			(void)next(s2, &ch2);
 		}
+		(void)next(s2, &ch2);
+	}
 
 	if (cflag)
 		for (cnt = 0, p = string1; cnt < NCHARS; ++p, ++cnt)

Reply via email to