z (06/07/82)
*** /usr/src/d41sys/dev/ttynew.c Wed Jul 8 12:30:04 1981 --- ttynew.c Thu Apr 29 09:52:10 1982 *************** *** 185,190 return; } else if (c==tlun.t_suspc || c==tun.t_intrc || c==tun.t_quitc) { flushtty(tp, c==tlun.t_suspc ? FREAD : FREAD|FWRITE); ntyecho(c, tp); c = c==tun.t_intrc ? SIGINT : --- 202,210 ----- return; } else if (c==tlun.t_suspc || c==tun.t_intrc || c==tun.t_quitc) { + #ifdef CCA + i = tp->t_state & TTSTOP; + #endif flushtty(tp, c==tlun.t_suspc ? FREAD : FREAD|FWRITE); ntyecho(c, tp); #ifdef CCA *************** *** 187,192 c==tun.t_quitc) { flushtty(tp, c==tlun.t_suspc ? FREAD : FREAD|FWRITE); ntyecho(c, tp); c = c==tun.t_intrc ? SIGINT : ((c==tun.t_quitc) ? SIGQUIT : SIGTSTP); if (tp->t_chan) --- 207,216 ----- #endif flushtty(tp, c==tlun.t_suspc ? FREAD : FREAD|FWRITE); ntyecho(c, tp); + #ifdef CCA + if (i) /* Only if stopped (z) */ + ntyecho('\n', tp); + #endif c = c==tun.t_intrc ? SIGINT : ((c==tun.t_quitc) ? SIGQUIT : SIGTSTP); if (tp->t_chan) *************** *** 192,197 if (tp->t_chan) scontrol(tp->t_chan, M_SIG, c); gsignal(tp->t_pgrp, c); /* check for buffer editing functions - cooked mode */ } else if ((t_flags&CBREAK) == 0) { if ((tp->t_lstate&LSQUOT) && --- 216,233 ----- if (tp->t_chan) scontrol(tp->t_chan, M_SIG, c); gsignal(tp->t_pgrp, c); + #ifdef CCA /* z - 1/6/81 */ + /* check for screen paging control functions */ + } else if (tp->t_scrline == tp->t_screen && tp->t_state&TTSTOP) { + if (c==' ') + tp->t_scrline = 1; + else if (c=='\r') + tp->t_scrline--; + else if (c=='D'-64 || c=='d' || c=='D') + tp->t_scrline = tp->t_screen/2; + else + return; + #endif /* check for buffer editing functions - cooked mode */ } else if ((t_flags&CBREAK) == 0) { if ((tp->t_lstate&LSQUOT) && *************** *** 820,825 if ((tp->t_lstate & LSCNTTB) == 0) tp->t_local &= ~LFLUSHO; if ((tp->t_flags&ECHO) == 0) return; c &= 0377; --- 870,878 ----- if ((tp->t_lstate & LSCNTTB) == 0) tp->t_local &= ~LFLUSHO; + #ifdef CCA /* z - 1/6/81 */ + tp->t_scrline = 0; /* Start page over */ + #endif if ((tp->t_flags&ECHO) == 0) return; c &= 0377; *************** *** 867,869 while (c = *cp++) (void) ntyoutput(c, tp); } --- 920,938 ----- while (c = *cp++) (void) ntyoutput(c, tp); } + + + #ifdef CCA /* z 1/8/81 */ + /* + * See if we're at the end of a screen page, and + * (optionally) freeze output if we are. + */ + ntpage(tp) + register struct tty *tp; + { + if (!(tp->t_flags&(RAW|CBREAK)) && tp->t_screen && ++tp->t_scrline == tp->t_screen) { + tp->t_state |= TTSTOP; + (*cdevsw[major(tp->t_dev)].d_stop)(tp); + } + } + #endif *** /usr/src/d41sys/dev/ttyold.c Wed Jul 8 12:30:07 1981 --- ttyold.c Thu Apr 29 09:52:11 1982 *************** *** 209,214 if (tp->t_chan) scontrol(tp->t_chan, M_SIG, c); gsignal(tp->t_pgrp, c); return; } if (c=='\r' && t_flags&CRMOD) --- 218,235 ----- if (tp->t_chan) scontrol(tp->t_chan, M_SIG, c); gsignal(tp->t_pgrp, c); + #ifdef CCA /* z - 1/6/81 */ + /* check for screen paging control functions */ + } else if (tp->t_scrline == tp->t_screen && tp->t_state&TTSTOP) { + if (c==' ') + tp->t_scrline = 1; + else if (c=='\r') + tp->t_scrline--; + else if (c=='D'-64 || c=='d' || c=='D') + tp->t_scrline = tp->t_screen/2; + else + return; + #endif return; } if (c=='\r' && t_flags&CRMOD) *** /usr/src/d41sys/dev/tty.c Sun Jul 26 00:37:29 1981 --- tty.c Thu Apr 29 09:52:09 1982 *************** *** 230,235 case TIOCLBIC: case TIOCLSET: case TIOCSTI: /* this is reasonable, but impractical... if ((flag & FWRITE) == 0) { u.u_error = EBADF; --- 231,239 ----- case TIOCLBIC: case TIOCLSET: case TIOCSTI: + #ifdef CCA + case TIOCSSCR: + #endif /* this is reasonable, but impractical... if ((flag & FWRITE) == 0) { u.u_error = EBADF; *************** *** 315,321 #endif } else if (tp->t_line == NTTYDISC) { if (tp->t_flags&RAW || iocb.sg_flags&RAW || ! com == TIOCSETP) wflushtty(tp); else if ((tp->t_flags&CBREAK) != (iocb.sg_flags&CBREAK)) { if (iocb.sg_flags & CBREAK) { --- 319,325 ----- #endif } else if (tp->t_line == NTTYDISC) { if (tp->t_flags&RAW || iocb.sg_flags&RAW || ! com == TIOCSETP) { wflushtty(tp); #ifdef CCA /* z - 1/8/81 */ tp->t_scrline = 0; /* reset line count */ *************** *** 317,323 if (tp->t_flags&RAW || iocb.sg_flags&RAW || com == TIOCSETP) wflushtty(tp); ! else if ((tp->t_flags&CBREAK) != (iocb.sg_flags&CBREAK)) { if (iocb.sg_flags & CBREAK) { catq(&tp->t_rawq, &tp->t_canq); tq = tp->t_rawq; --- 321,330 ----- if (tp->t_flags&RAW || iocb.sg_flags&RAW || com == TIOCSETP) { wflushtty(tp); ! #ifdef CCA /* z - 1/8/81 */ ! tp->t_scrline = 0; /* reset line count */ ! #endif ! } else if ((tp->t_flags&CBREAK) != (iocb.sg_flags&CBREAK)) { if (iocb.sg_flags & CBREAK) { catq(&tp->t_rawq, &tp->t_canq); tq = tp->t_rawq; *************** *** 324,329 tp->t_rawq = tp->t_canq; tp->t_canq = tq; } else { tp->t_local |= LPENDIN; if (tp->t_canq.c_cc) panic("ioccom canq"); --- 331,339 ----- tp->t_rawq = tp->t_canq; tp->t_canq = tq; } else { + #ifdef CCA /* z - 9/16/81 */ + tp->t_scrline = 0; + #endif tp->t_local |= LPENDIN; if (tp->t_canq.c_cc) panic("ioccom canq"); *************** *** 503,508 else (*linesw[tp->t_line].l_rint)(c, tp); break; /* end of locals */ default: --- 530,555 ----- else (*linesw[tp->t_line].l_rint)(c, tp); break; + + #ifdef CCA /* z - 1/6/81 */ + /* CCA locals */ + /* + * Set/get terminal screen length. + */ + case TIOCSSCR: + if (copyin(addr, (caddr_t)&temp, sizeof (tp->t_screen))) + u.u_error = EFAULT; + else { + tp->t_screen = temp; + tp->t_scrline = 0; + } + break; + + case TIOCGSCR: + if (copyout((caddr_t)&tp->t_screen, addr, sizeof(tp->t_screen))) + u.u_error = EFAULT; + break; + #endif /* end of locals */ default: *** /usr/src/d41sys/sys/prim.c Sun Apr 26 18:20:47 1981 --- ../sys/prim.c Thu Apr 29 09:52:39 1982 *************** *** 114,119 * Return count of contiguous characters * in clist starting at q->c_cf. * Stop counting if flag&character is non-null. */ ndqb(q, flag) register struct clist *q; --- 115,121 ----- * Return count of contiguous characters * in clist starting at q->c_cf. * Stop counting if flag&character is non-null. + * Also stop if end of line hit. */ ndqb(q, flag) register struct clist *q; *************** *** 142,147 cc -= (int)q->c_cf; break; } p++; } } --- 144,155 ----- cc -= (int)q->c_cf; break; } + #ifdef CCA + if ((*p & 0177) == '\r') { + cc = (int)p - (int)q->c_cf + 1; + break; + } + #endif p++; } } *** /usr/src/d41sys/dev/dh.c Fri Jul 10 13:37:50 1981 --- dh.c Thu Apr 29 09:50:04 1982 *************** *** 461,466 short ttybit, bar, *sbar; register struct uba_device *ui; register int unit; u_short cntr; ui = dhinfo[dh]; --- 466,472 ----- short ttybit, bar, *sbar; register struct uba_device *ui; register int unit; + register char *oldcf; u_short cntr; ui = dhinfo[dh]; *************** *** 489,494 */ cntr = addr->dhcar - UBACVT(tp->t_outq.c_cf, ui->ui_ubanum); ndflush(&tp->t_outq, (int)cntr); } if (tp->t_line) --- 495,502 ----- */ cntr = addr->dhcar - UBACVT(tp->t_outq.c_cf, ui->ui_ubanum); + #ifdef CCA + oldcf = tp->t_outq.c_cf; ndflush(&tp->t_outq, (int)cntr); if ((*(oldcf + (int)cntr - 1) & 0177) == '\r') ntpage(tp); *************** *** 490,495 cntr = addr->dhcar - UBACVT(tp->t_outq.c_cf, ui->ui_ubanum); ndflush(&tp->t_outq, (int)cntr); } if (tp->t_line) (*linesw[tp->t_line].l_start)(tp); --- 498,508 ----- #ifdef CCA oldcf = tp->t_outq.c_cf; ndflush(&tp->t_outq, (int)cntr); + if ((*(oldcf + (int)cntr - 1) & 0177) == '\r') + ntpage(tp); + #else + ndflush(&tp->t_outq, (int)cntr); + #endif } if (tp->t_line) (*linesw[tp->t_line].l_start)(tp); *** /usr/src/d41sys/dev/dz.c Sun Jul 26 00:41:56 1981 --- dz.c Thu Apr 29 09:50:42 1982 *************** *** 338,344 tp->t_state &= ~BUSY; if (tp->t_state & FLUSH) tp->t_state &= ~FLUSH; ! else ndflush(&tp->t_outq, dp->p_mem-tp->t_outq.c_cf); if (tp->t_line) (*linesw[tp->t_line].l_start)(tp); --- 351,357 ----- tp->t_state &= ~BUSY; if (tp->t_state & FLUSH) tp->t_state &= ~FLUSH; ! else { ndflush(&tp->t_outq, dp->p_mem-tp->t_outq.c_cf); #ifdef CCA if ((*(dp->p_mem-1) & 0177) == '\r') *************** *** 340,345 tp->t_state &= ~FLUSH; else ndflush(&tp->t_outq, dp->p_mem-tp->t_outq.c_cf); if (tp->t_line) (*linesw[tp->t_line].l_start)(tp); else --- 353,363 ----- tp->t_state &= ~FLUSH; else { ndflush(&tp->t_outq, dp->p_mem-tp->t_outq.c_cf); + #ifdef CCA + if ((*(dp->p_mem-1) & 0177) == '\r') + ntpage(tp); + } + #endif if (tp->t_line) (*linesw[tp->t_line].l_start)(tp); else *** /usr/src/d41sys/h/tty.h Thu Jul 9 04:43:49 1981 --- ../h/tty.h Wed Oct 21 17:27:22 1981 *************** *** 81,86 struct tchars t_chr; struct clist t_ctlq; } t_un; }; #define tun tp->t_un.t_chr --- 81,88 ----- struct tchars t_chr; struct clist t_ctlq; } t_un; + short t_screen; /* Number of lines per terminal screen */ + short t_scrline; /* Number of current screen line */ }; #define tun tp->t_un.t_chr *** /usr/src/d41sys/h/ioctl.h Thu Apr 2 17:37:24 1981 --- ../h/ioctl.h Wed Oct 21 17:18:50 1981 *************** *** 82,87 #define TIOCGLTC (('t'<<8)|116) /* get local special characters */ #define TIOCOUTQ (('t'<<8)|115) /* number of chars in output queue */ #define TIOCSTI (('t'<<8)|114) /* simulate a terminal in character */ #define OTTYDISC 0 /* old, v7 std tty driver */ #define NETLDISC 1 /* line discip for berk net */ --- 84,92 ----- #define TIOCGLTC (('t'<<8)|116) /* get local special characters */ #define TIOCOUTQ (('t'<<8)|115) /* number of chars in output queue */ #define TIOCSTI (('t'<<8)|114) /* simulate a terminal in character */ + /* CCA locals, from 64 sideways */ + #define TIOCSSCR (('t'<<8)|64) /* set screen length */ + #define TIOCGSCR (('t'<<8)|65) /* get screen length */ #define OTTYDISC 0 /* old, v7 std tty driver */ #define NETLDISC 1 /* line discip for berk net */ *** ostty.c Wed Jul 8 21:48:57 1981 --- stty.c Mon Jun 7 10:56:26 1982 *************** *** 148,153 0 }; char *arg; int argc; char **argv; --- 151,159 ----- 0 }; char *arg; + char buf[1024]; + char screen; + char *getenv(); int argc; char **argv; *************** *** 167,172 ioctl(1, TIOCGETC, &tc); ioctl(1, TIOCLGET, &lmode); ioctl(1, TIOCGLTC, <c); if(argc == 1) { prmodes(0); exit(0); --- 173,179 ----- ioctl(1, TIOCGETC, &tc); ioctl(1, TIOCLGET, &lmode); ioctl(1, TIOCGLTC, <c); + ioctl(1, TIOCGSCR, &screen); if(argc == 1) { prmodes(0); exit(0); *************** *** 278,283 lmode &= ~modes[i].lreset; lmode |= modes[i].lset; } if(arg) fprintf(stderr,"unknown mode: %s\n", arg); cont: --- 285,301 ----- lmode &= ~modes[i].lreset; lmode |= modes[i].lset; } + if (eq("page")) { + if (tgetent(buf, getenv("TERM")) < 1) + continue; + if (!tgetflag("hc") && (screen = tgetnum("li")) > 0) + ioctl(1, TIOCSSCR, &screen); + continue; + } + if (eq("-page")) { + screen = 0; + ioctl(1, TIOCSSCR, &screen); + } if(arg) fprintf(stderr,"unknown mode: %s\n", arg); cont: *************** *** 352,357 delay((m&VTDELAY)/FF1, "ff"); if(all==2 || (m&BSDELAY)) delay((m&BSDELAY)/BS1, "bs"); if (all) fprintf(stderr,"\n"); #define lpit(what,str) \ --- 370,377 ----- delay((m&VTDELAY)/FF1, "ff"); if(all==2 || (m&BSDELAY)) delay((m&BSDELAY)/BS1, "bs"); + if(all==2 || screen) + fprintf(stderr,"-page "+(screen!=0)); if (all) fprintf(stderr,"\n"); #define lpit(what,str) \ *************** *** 516,522 } int speed[] = { ! 0,50,75,110,134,150,200,300,600,1200,1800,2400,4800,9600,0,0 }; prspeed(c, s) --- 537,543 ----- } int speed[] = { ! 0,50,75,110,134,150,200,300,600,1200,1800,2400,4800,9600,19200,0 }; prspeed(c, s) *** ologin.c Wed Jul 8 18:11:21 1981 --- login.c Mon Jun 7 10:56:31 1982 *************** *** 241,246 else namep++; strcat(minusnam, namep); alarm(0); #ifdef ARPAVAX if (pwd->pw_gid == 27) /* UGLY ! */ --- 261,269 ----- else namep++; strcat(minusnam, namep); + if (tgetent(buf, term+5) < 1 || tgetflag("hc") || (lclmode = tgetnum("li")) < 0) + lclmode = 0; + ioctl(1, TIOCSSCR, &lclmode); alarm(0); umask(2); if (ttyn[LMAX] == 'd') *** ostty.1 Mon Jun 7 12:40:44 1982 --- stty.1 Mon Jun 7 12:39:36 1982 *************** *** 437,442 Diablo style etx/ack handshaking (not implemented). .br .ns .PP The following special characters are applicable only to the new teletype driver --- 437,452 ----- Diablo style etx/ack handshaking (not implemented). .br .ns + .TP 10 + .B page + Stop output after every page, as in the + .I more + command. + .br + .ns + .TP 10 + .B \-page + Produce output continuously. .PP The following special characters are applicable only to the new teletype driver *** otty.4 Mon Jun 7 12:41:49 1982 --- tty.4 Mon Jun 7 12:41:10 1982 *************** *** 810,815 args is the address of a .I ltchars structure into which is placed the current set of local special characters. .SH FILES /dev/tty .br --- 810,838 ----- args is the address of a .I ltchars structure into which is placed the current set of local special characters. + .LP + .Ul "Page mode" + .PP + It is possible to put a terminal in page mode using the TIOCSSCR + .I ioctl. + Page mode operates very similarly to the now obsolete + .I more + command, with space advancing the screen + a full page, d, D, or control-D advancing + the screen a half page, and carriage return advancing the screen a single + line. A control-Q typed at the end of a page + will disable page mode until the next character is + typed. The applicable + .I ioctl + calls are: + .IP TIOCSSCR 12 + arg is the address of the number of lines on the terminal screen. This + .I ioctl + sets page mode. If this number is zero, page mode is disabled. + .IP TIOCGSCR 12 + arg is the address of the number of lines on the terminal screen; this + call merely returns this number to the user. If this address contains + zero, page mode was disabled at the time of the call. .SH FILES /dev/tty .br