]> err.no Git - util-linux/commitdiff
look: fix problem with !isalnum() words
authorKarel Zak <kzak@redhat.com>
Tue, 6 Mar 2007 12:14:52 +0000 (13:14 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 6 Mar 2007 12:14:52 +0000 (13:14 +0100)
for example "$ look apple-pie"

Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/look.c
tests/expected/ts-look-separator

index f7bcc16e00b5bfaf0932cb75e0037d1674afc1e7..7ffd8a3e2db0a066a6641c3f11fc176f5da08c44 100644 (file)
@@ -327,9 +327,12 @@ compare(char *s2, char *s2end) {
        /* copy, ignoring things that should be ignored */
        p = comparbuf;
        i = stringlen;
-       while(s2 < s2end && *s2 != '\n' && i--) {
+       while(s2 < s2end && *s2 != '\n' && i) {
                if (!dflag || isalnum(*s2))
+               {
                        *p++ = *s2;
+                       i--;
+               }
                s2++;
        }
        *p = 0;
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..8c19d03622ae742e6258ad2542acf5c8bd0db07c 100644 (file)
@@ -0,0 +1 @@
+apple-pie