diff options
author | Peter Valchev <pvalchev@cvs.openbsd.org> | 2001-05-24 02:58:51 +0000 |
---|---|---|
committer | Peter Valchev <pvalchev@cvs.openbsd.org> | 2001-05-24 02:58:51 +0000 |
commit | f31553fd50e6e5af57e125a38799de79f8b63fb3 (patch) | |
tree | 878c69937453ca431d9949b3fdd5e0e7905fb302 /usr.bin | |
parent | 4c203ea1b531f093f6f4286ab661ac12634aa062 (diff) |
Don't convert a single space before a tab stop into a tab when the -i
option is passed, as stated in the manual page.
From NetBSD PR 5797 fix.
millert@ ok
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/pr/pr.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/usr.bin/pr/pr.c b/usr.bin/pr/pr.c index e354ae0dab4..47bda2d0f83 100644 --- a/usr.bin/pr/pr.c +++ b/usr.bin/pr/pr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pr.c,v 1.9 2001/02/05 01:57:12 deraadt Exp $ */ +/* $OpenBSD: pr.c,v 1.10 2001/05/24 02:58:50 pvalchev Exp $ */ /*- * Copyright (c) 1991 Keith Muller. @@ -45,7 +45,7 @@ static char copyright[] = #ifndef lint /* from: static char sccsid[] = "@(#)pr.c 8.1 (Berkeley) 6/6/93"; */ -static char *rcsid = "$OpenBSD: pr.c,v 1.9 2001/02/05 01:57:12 deraadt Exp $"; +static char *rcsid = "$OpenBSD: pr.c,v 1.10 2001/05/24 02:58:50 pvalchev Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -1236,6 +1236,13 @@ otln(buf, cnt, svips, svops, mor) */ while (ops < ips) { /* + * use one space if necessary + */ + if (ips - ops == 1) { + putchar(' '); + break; + } + /* * use as many ochar as will fit */ if ((tbps = ops + gap - (ops % gap)) > ips) @@ -1281,6 +1288,13 @@ otln(buf, cnt, svips, svops, mor) if (mor < 0) { while (ops < ips) { /* + * use one space if necessary + */ + if (ips - ops == 1) { + putchar(' '); + break; + } + /* * use as many ochar as will fit */ if ((tbps = ops + gap - (ops % gap)) > ips) @@ -1291,6 +1305,7 @@ otln(buf, cnt, svips, svops, mor) } ops = tbps; } + while (ops < ips) { /* * finish off with spaces |