Article View: net.bugs.4bsd
Article #1601'more' doesn't understand 'xn' type terminals (such as 'xterm')
From: Donn Seeley
Date: Sun, 27 Jul 1986 09:02
Date: Sun, 27 Jul 1986 09:02
74 lines
3047 bytes
3047 bytes
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@utah-cs.arpa
40 46' 6"N 111 50' 34"W (801) 581-5668 decvax!utah-cs!donn
Technical Details
Message-ID:
<3864@utah-cs.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!utah-cs!donnShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!utah-cs!donn From: donn@utah-cs.UUCP (Donn Seeley) Newsgroups: net.bugs.4bsd Subject: 'more' doesn't understand 'xn' type terminals (such as 'xterm') Message-ID: <3864@utah-cs.UUCP> Date: Sun, 27-Jul-86 05:02:13 EDT Article-I.D.: utah-cs.3864 Posted: Sun Jul 27 05:02:13 1986 Date-Received: Sun, 27-Jul-86 09:37:06 EDT Organization: University of Utah CS Dept Lines: 74