projects
/
unix-history
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e3364dd
)
fixed col's entab algorithm which was losing spaces
author
Andrew Moore
<alm@FreeBSD.org>
Wed, 28 Jul 1993 09:45:29 +0000
(09:45 +0000)
committer
Andrew Moore
<alm@FreeBSD.org>
Wed, 28 Jul 1993 09:45:29 +0000
(09:45 +0000)
usr.bin/col/col.c
patch
|
blob
|
blame
|
history
diff --git
a/usr.bin/col/col.c
b/usr.bin/col/col.c
index
375bb6c
..
709bfd4
100644
(file)
--- a/
usr.bin/col/col.c
+++ b/
usr.bin/col/col.c
@@
-101,6
+101,9
@@
int no_backspaces; /* if not to output any backspaces */
if (putchar(ch) == EOF) \
wrerr();
if (putchar(ch) == EOF) \
wrerr();
+/* next tabstop after col */
+#define TABSTOP(col,ts) ((col) + (ts) - (col) % (ts))
+
main(argc, argv)
int argc;
char **argv;
main(argc, argv)
int argc;
char **argv;
@@
-424,10
+427,17
@@
flush_line(l)
if (compress_spaces && nspace > 1) {
int ntabs;
if (compress_spaces && nspace > 1) {
int ntabs;
+ while ((ntabs = TABSTOP(last_col, 8)) <= this_col) {
+ PUTC('\t');
+ last_col = ntabs;
+ }
+ nspace = this_col - last_col;
+/*
ntabs = this_col / 8 - last_col / 8;
nspace -= ntabs * 8;
while (--ntabs >= 0)
PUTC('\t');
ntabs = this_col / 8 - last_col / 8;
nspace -= ntabs * 8;
while (--ntabs >= 0)
PUTC('\t');
+*/
}
while (--nspace >= 0)
PUTC(' ');
}
while (--nspace >= 0)
PUTC(' ');