summaryrefslogtreecommitdiffstats
path: root/usr.bin/fmt
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-05-11 21:32:35 +0000
committerache <ache@FreeBSD.org>1995-05-11 21:32:35 +0000
commitcd84e329a9f4ad5ccd856df2daba6ddcf0713332 (patch)
tree99c586035a31de1494ff8d6e9b80600687591e02 /usr.bin/fmt
parentd86322bd5b8930525288f895e842a895a2327af3 (diff)
downloadFreeBSD-src-cd84e329a9f4ad5ccd856df2daba6ddcf0713332.zip
FreeBSD-src-cd84e329a9f4ad5ccd856df2daba6ddcf0713332.tar.gz
Make fmt ctype-aware
Fix non-critical bug with getting EOF double times Not call strlen for zero length test
Diffstat (limited to 'usr.bin/fmt')
-rw-r--r--usr.bin/fmt/fmt.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c
index 565adf4..67e5931 100644
--- a/usr.bin/fmt/fmt.c
+++ b/usr.bin/fmt/fmt.c
@@ -134,7 +134,7 @@ fmt(fi)
FILE *fi;
{
char linebuf[BUFSIZ], canonb[BUFSIZ];
- register char *cp, *cp2;
+ register char *cp, *cp2, cc;
register int c, col;
c = getc(fi);
@@ -151,7 +151,7 @@ fmt(fi)
c = getc(fi);
continue;
}
- if ((c < ' ' || c >= 0177) && c != '\t') {
+ if (!isprint(c) && c != '\t') {
c = getc(fi);
continue;
}
@@ -172,11 +172,11 @@ fmt(fi)
col = 0;
cp = linebuf;
cp2 = canonb;
- while (c = *cp++) {
- if (c != '\t') {
+ while (cc = *cp++) {
+ if (cc != '\t') {
col++;
if (cp2-canonb < BUFSIZ-1)
- *cp2++ = c;
+ *cp2++ = cc;
continue;
}
do {
@@ -211,7 +211,7 @@ prefix(line)
register char *cp, **hp;
register int np, h;
- if (strlen(line) == 0) {
+ if (!*line) {
oflush();
putchar('\n');
return;
OpenPOWER on IntegriCloud