Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/tr apply some CSE



details:   https://anonhg.NetBSD.org/src/rev/2113247a94e7
branches:  trunk
changeset: 789193:2113247a94e7
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Aug 11 00:12:47 2013 +0000

description:
apply some CSE

diffstat:

 usr.bin/tr/tr.c |  18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diffs (41 lines):

diff -r b89915b73e7e -r 2113247a94e7 usr.bin/tr/tr.c
--- a/usr.bin/tr/tr.c   Sun Aug 11 00:11:46 2013 +0000
+++ b/usr.bin/tr/tr.c   Sun Aug 11 00:12:47 2013 +0000
@@ -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 @@
 #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 @@
                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)



Home | Main Index | Thread Index | Old Index