[hackers] [sbase] strings: Rename `len` to `min` || Michael Forney
commit 7ef4038fb5b93e63f4223ab9f222526130a1e14f
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Thu Jan 14 21:45:37 2021 -0800
Commit: Michael Forney <mforney_AT_mforney.org>
CommitDate: Thu Jan 14 21:46:30 2021 -0800
strings: Rename `len` to `min`
diff --git a/strings.c b/strings.c
index a99642e..8f5a154 100644
--- a/strings.c
+++ b/strings.c
_AT_@ -10,33 +10,33 @@
static char *format = "";
static void
-strings(FILE *fp, const char *fname, size_t len)
+strings(FILE *fp, const char *fname, size_t min)
{
Rune r, *rbuf;
size_t i, bread;
off_t off;
- rbuf = ereallocarray(NULL, len, sizeof(*rbuf));
+ rbuf = ereallocarray(NULL, min, sizeof(*rbuf));
for (off = 0, i = 0; (bread = efgetrune(&r, fp, fname)); ) {
off += bread;
if (r == Runeerror)
continue;
if (!isprintrune(r)) {
- if (i == len)
+ if (i == min)
putchar('\n');
i = 0;
continue;
}
- if (i == len) {
+ if (i == min) {
efputrune(&r, stdout, "<stdout>");
continue;
}
rbuf[i++] = r;
- if (i < len)
+ if (i < min)
continue;
printf(format, (long)off - i);
- for (i = 0; i < len; i++)
+ for (i = 0; i < min; i++)
efputrune(rbuf + i, stdout, "<stdout>");
}
free(rbuf);
_AT_@ -52,7 +52,7 @@ int
main(int argc, char *argv[])
{
FILE *fp;
- size_t len = 4;
+ size_t min = 4;
int ret = 0;
char f;
_AT_@ -60,7 +60,7 @@ main(int argc, char *argv[])
case 'a':
break;
case 'n':
- len = estrtonum(EARGF(usage()), 1, LLONG_MAX);
+ min = estrtonum(EARGF(usage()), 1, LLONG_MAX);
break;
case 't':
format = estrdup("%8l#: ");
_AT_@ -75,7 +75,7 @@ main(int argc, char *argv[])
} ARGEND
if (!argc) {
- strings(stdin, "<stdin>", len);
+ strings(stdin, "<stdin>", min);
} else {
for (; *argv; argc--, argv++) {
if (!strcmp(*argv, "-")) {
_AT_@ -86,7 +86,7 @@ main(int argc, char *argv[])
ret = 1;
continue;
}
- strings(fp, *argv, len);
+ strings(fp, *argv, min);
if (fp != stdin && fshut(fp, *argv))
ret = 1;
}
Received on Fri Jan 15 2021 - 06:48:37 CET
This archive was generated by hypermail 2.3.0
: Fri Jan 15 2021 - 06:49:10 CET