diff options
author | Karel Zak | 2007-03-06 13:14:52 +0100 |
---|---|---|
committer | Karel Zak | 2007-03-06 13:14:52 +0100 |
commit | dab737cc42a844e439b58562804f4ce60689c792 (patch) | |
tree | 8d933e7745ce8198f8c3a314217709a50884fa3e /misc-utils/look.c | |
parent | tests: add look test for words with separator (diff) | |
download | kernel-qcow2-util-linux-dab737cc42a844e439b58562804f4ce60689c792.tar.gz kernel-qcow2-util-linux-dab737cc42a844e439b58562804f4ce60689c792.tar.xz kernel-qcow2-util-linux-dab737cc42a844e439b58562804f4ce60689c792.zip |
look: fix problem with !isalnum() words
for example "$ look apple-pie"
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/look.c')
-rw-r--r-- | misc-utils/look.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/misc-utils/look.c b/misc-utils/look.c index f7bcc16e0..7ffd8a3e2 100644 --- a/misc-utils/look.c +++ b/misc-utils/look.c @@ -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; |