1 diff -Nur util-linux-2.9r/text-utils/more.c util-linux-2.9r.pld/text-utils/more.c
2 --- util-linux-2.9r/text-utils/more.c Sat Mar 20 21:20:18 1999
3 +++ util-linux-2.9r.pld/text-utils/more.c Sun May 23 13:47:46 1999
5 char *shell; /* The name of the shell to use */
6 int shellp; /* A previous shell command exists */
10 char Line[LINSIZ]; /* Line buffer */
11 int Lpp = 24; /* lines per page */
12 char *Clear; /* clear screen */
14 char *cursorm; /* cursor movement */
15 char cursorhome[40]; /* contains cursor movement to home */
16 char *EodClr; /* clear rest of screen */
18 int Mcol = 80; /* number of columns */
19 int Wrap = 1; /* set if automargins */
20 int soglitch; /* terminal has standout mode glitch */
22 int pstate = 0; /* current UL state */
25 +char termbuffer[2048];
27 +char * strbuf = termbuffer;
30 } context, screen_start;
32 if ((f = checkf (fnames[fnum], &clearit)) != NULL) {
33 context.line = context.chrctr = 0;
35 - if (firstf) setjmp (restore);
36 + if (firstf) sigsetjmp (restore, 1);
41 skiplns (initline, f);
43 else if (fnum < nfiles && !no_tty) {
45 + sigsetjmp (restore, 1);
46 left = command (fnames[fnum], f);
54 + sigsetjmp (restore, 1);
57 screen_start.line = screen_start.chrctr = 0L;
63 + tputs (ULexit, 1, putchar);
72 + sigsetjmp (restore, 1);
73 Pause = 0; startup = 0;
74 if ((num_lines = command (NULL, f)) == 0)
79 signal(SIGQUIT, onquit);
80 - longjmp (restore, 1);
81 + siglongjmp (restore, 1);
88 if (Senter && Sexit) {
90 + tputs (Senter, 1, putchar);
91 promptlen += (2 * soglitch);
95 promptlen += pr(_("[Press space to continue, 'q' to quit.]"));
99 + tputs (Sexit, 1, putchar);
104 if (!hardtabs || (column < promptlen && !hard)) {
105 if (hardtabs && eraseln && !dumb) {
106 column = 1 + (column | 7);
108 + tputs (eraseln, 1, putchar);
115 if (!dumb && eraseln)
117 + tputs (eraseln, 1, putchar);
119 for (col = promptlen - col; col > 0; col--)
121 @@ -900,12 +902,12 @@
126 + tputs(eraseln, 1, putchar);
132 + tputs(EodClr, 1, putchar);
136 @@ -949,13 +951,13 @@
137 if (c == ' ' && state == 0 && ulglitch && wouldul(s, n-1))
140 - putp(state ? ULenter : ULexit);
141 + tputs(state ? ULenter : ULexit, 1, putchar);
143 if (c != ' ' || pstate == 0 || state != 0 || ulglitch == 0)
145 if (state && *chUL) {
148 + tputs(chUL, 1, putchar);
155 if (Clear && !hard) {
157 + tputs(Clear, 1, putchar);
159 /* Put out carriage return so that system doesn't
160 ** get confused by escape sequences when expanding tabs
166 + tputs(Home, 1, putchar);
169 static int lastcmd, lastarg, lastp;
170 @@ -1200,9 +1202,9 @@
173 if (Senter && Sexit) {
175 + tputs (Senter, 1, putchar);
176 promptlen = pr (_("[Press 'h' for instructions.]")) + (2 * soglitch);
178 + tputs (Sexit, 1, putchar);
181 promptlen = pr (_("[Press 'h' for instructions.]"));
182 @@ -1569,7 +1571,7 @@
183 if ((term = getenv("TERM")) == 0) {
186 - setupterm(term, 1, &ret);
187 + ret = tgetent(tcbuffer, getenv("TERM"));
191 @@ -1577,35 +1579,35 @@
193 if (ioctl(fileno(stdout), TIOCGWINSZ, &win) < 0) {
195 - Lpp = tigetnum("lines");
196 - Mcol = tigetnum("cols");
197 + Lpp = tgetnum("li");
198 + Mcol = tgetnum("co");
201 if ((Lpp = win.ws_row) == 0)
202 - Lpp = tigetnum("lines");
203 + Lpp = tgetnum("li");
204 if ((Mcol = win.ws_col) == 0)
205 - Mcol = tigetnum("cols");
206 + Mcol = tgetnum("co");
209 - if ((Lpp <= 0) || tigetflag("hc")) {
210 + if ((Lpp <= 0) || tgetflag("hc")) {
211 hard++; /* Hard copy terminal */
215 - if (tigetflag("xenl"))
216 + if (tgetflag("xn"))
217 eatnl++; /* Eat newline at last column + 1; dec, concept */
221 if (tailequ (fnames[0], "page"))
223 - Wrap = tigetflag("am");
224 - bad_so = tigetflag ("xhp");
225 - eraseln = tigetstr("el");
226 - Clear = tigetstr("clear");
227 - Senter = tigetstr("smso");
228 - Sexit = tigetstr("rmso");
229 - if ((soglitch = tigetnum("xmc")) < 0)
230 + Wrap = tgetflag("am");
231 + bad_so = tgetflag ("xs");
232 + eraseln = tgetstr("ce", &strbuf);
233 + Clear = tgetstr("cl", &strbuf);
234 + Senter = tgetstr("co", &strbuf);
235 + Sexit = tgetstr("se", &strbuf);
236 + if ((soglitch = tgetnum("sg")) < 0)
240 @@ -1616,12 +1618,12 @@
241 * isn't available, settle for standout sequence.
244 - if (tigetflag("ul") || tigetflag("os"))
245 + if (tgetflag("ul") || tgetflag("os"))
247 - if ((chUL = tigetstr("uc")) == NULL )
248 + if ((chUL = tgetstr("uc", &strbuf)) == NULL )
250 - if (((ULenter = tigetstr("smul")) == NULL ||
251 - (ULexit = tigetstr("rmul")) == NULL) && !*chUL) {
252 + if (((ULenter = tgetstr("us", &strbuf)) == NULL ||
253 + (ULexit = tgetstr("ue", &strbuf)) == NULL) && !*chUL) {
254 if ((ULenter = Senter) == NULL || (ULexit = Sexit) == NULL) {
257 @@ -1631,20 +1633,20 @@
261 - if ((padstr = tigetstr("pad")) != NULL)
262 + if ((padstr = tgetstr("pc", &strbuf)) != NULL)
264 - Home = tigetstr("home");
265 + Home = tgetstr("ho", &strbuf);
266 if (Home == 0 || *Home == '\0')
268 - if ((cursorm = tigetstr("cup")) != NULL) {
269 - const char *t = (const char *)tparm(cursorm, 0, 0);
270 + if ((cursorm = tgetstr("cm", &strbuf)) != NULL) {
271 + const char *t = (const char *)tgoto(cursorm, 0, 0);
272 strncpy(cursorhome, t, sizeof(cursorhome));
273 cursorhome[sizeof(cursorhome)-1] = 0;
277 - EodClr = tigetstr("ed");
278 - if ((chBS = tigetstr("cub1")) == NULL)
279 + EodClr = tgetstr("cd", &strbuf);
280 + if ((chBS = tgetstr("le", &strbuf)) == NULL)
284 @@ -1716,7 +1718,7 @@
287 if (!eraseln) promptlen = maxlen;
288 - longjmp (restore, 1);
289 + siglongjmp (restore, 1);
292 else if ((ch == otty.c_cc[VKILL]) && !slash) {
293 @@ -1857,15 +1859,15 @@
295 promptlen += strlen (mess);
296 if (Senter && Sexit) {
298 + tputs (Senter, 1, putchar);
301 + tputs (Sexit, 1, putchar);
307 - longjmp (restore, 1);
308 + siglongjmp (restore, 1);
312 @@ -1937,5 +1939,5 @@
313 signal (SIGTSTP, onsusp);
316 - longjmp (restore, 1);
317 + siglongjmp (restore, 1);