[hackers] [sbase] Fix small issue in strings(1) loop || FRIGN
commit e739ca727f72b47faf17d2af9dd8fb56b47be12a
Author: FRIGN <dev_AT_frign.de>
Date: Tue Feb 17 18:10:22 2015 +0100
Fix small issue in strings(1) loop
It wouldn't print the len'th character.
diff --git a/strings.c b/strings.c
index 9bbf1e2..4b365f2 100644
--- a/strings.c
+++ b/strings.c
_AT_@ -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);
Received on Tue Feb 17 2015 - 18:33:39 CET
This archive was generated by hypermail 2.3.0
: Tue Feb 17 2015 - 18:36:14 CET