'more' doesn't understand 'xn' type terminals (such as 'xterm')
Donn Seeley
donn at utah-cs.UUCP
Sun Jul 27 19:02:13 AEST 1986
Subject: 'more' doesn't understand 'xn' type terminals (such as 'xterm')
Index: ucb/more/more.c 4.3BSD
Description:
When you run 'more' on a terminal which has the 'eat newline'
feature described by the 'xn' termcap capability, it can screw
up and lose blank lines.
Repeat-By:
Go to a terminal with the 'eat newline' feature; it's easy to
see the problem when you use a window created by the 'xterm'
terminal emulator of the X window system. Run the C-shell
command:
% (repeat 80 -n echo a; repeat 2 echo '') | more
(Substitute the appropriate screen width for '80' if you use
something different.) Run the same command on a normal terminal
and compare -- 'more' on the 'eat newline' terminal will lose
the blank line.
Fix:
'more' has no code to handle 'xn' terminals, but it's easy to
add. Make the following changes to 'more.c', in the
declarations at the top and in the routines getline() and
initterm():
------------------------------------------------------------
*** /tmp/,RCSt1024200 Sun Jul 27 02:52:05 1986
--- more.c Sun Jul 27 02:14:23 1986
***************
*** 76,82 ****
int inwait, Pause, errors;
int within; /* true if we are within a file,
false if we are between files */
! int hard, dumb, noscroll, hardtabs, clreol;
int catch_susp; /* We should catch the SIGTSTP signal */
char **fnames; /* The list of file names */
int nfiles; /* Number of files left to process */
--- 76,82 ----
int inwait, Pause, errors;
int within; /* true if we are within a file,
false if we are between files */
! int hard, dumb, noscroll, hardtabs, clreol, eatnl;
int catch_susp; /* We should catch the SIGTSTP signal */
char **fnames; /* The list of file names */
int nfiles; /* Number of files left to process */
***************
*** 768,773 ****
--- 768,776 ----
}
}
colflg = column == Mcol && fold_opt;
+ if (colflg && eatnl && Wrap) {
+ *p++ = '\n'; /* simulate normal wrap */
+ }
*length = p - Line;
*p = 0;
return (column);
***************
*** 1494,1499 ****
--- 1497,1504 ----
hard++; /* Hard copy terminal */
Lpp = 24;
}
+ if (tgetflag("xn"))
+ eatnl++; /* Eat newline at last column + 1; dec, concept */
if (Mcol <= 0)
Mcol = 80;
------------------------------------------------------------
Donn Seeley University of Utah CS Dept donn at utah-cs.arpa
40 46' 6"N 111 50' 34"W (801) 581-5668 decvax!utah-cs!donn
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list