sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 439bf8a157c6e4260c5fac94881b3e86a3dc86d7
parent aa6ac30b815adf52b1c3c705120bad59081ba697
Author: FRIGN <dev@frign.de>
Date:   Tue, 17 Feb 2015 18:10:22 +0100

Fix small issue in strings(1) loop

It wouldn't print the len'th character.

Diffstat:
Mstrings.c | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/strings.c b/strings.c @@ -21,23 +21,23 @@ strings(FILE *fp, const char *fname, size_t len) off += bread; if (r == Runeerror) continue; - else if (!isprintrune(r)) { + if (!isprintrune(r)) { if (i > len) putchar('\n'); i = 0; continue; } - if (i < len) { + if (i <= len) { rbuf[i++] = r; - continue; - } else if (i > len) { + if (i < len) + continue; + } else { efputrune(&r, stdout, "<stdout>"); continue; } printf(format, (long)off - i); - for (i = 0; i < len; i++) { + for (i = 0; i < len; i++) efputrune(rbuf + i, stdout, "<stdout>"); - } i++; } free(rbuf);