%%s 4/2/141 %%d D 1.3 24-Nov-82 17:08:07 sventek 3 2 %%c Modified crt.w`crt.r`prtnl to output a carriage return if in raw mode when %%c a q is detected. On some systems, the next line is output at the end of %%c the [...] prompt. %%s 30/16/113 %%d D 1.2 06-May-82 06:24:50 j 2 1 %%c Modified crt.w`crt.r`prtnl in two ways: %%c %%c 1. If crt is unable to set the unit assigned to TERMINAL_IN to rare mode, %%c the old behavior is performed, such that it works when in batch streams %%c and on systems not supporting non-COOKED IO. %%c %%c 2. If the terminal is in RARE mode and the response to the prompt is %%c printable, then the response is echoed on the terminal screen. %%s 0/0/0 %%d D 1.1 25-Mar-82 12:03:03 v1.1 1 0 %%c Version 1.1 is the Spring 1982 Distribution of the LBL/Hughes release %%c of the Software Tools Virtual Operating System software and documentation. %%T %%I 1 %%D 2 #-h- crt.r 1744 asc 25-mar-82 07:30:08 v1.1 (sw-tools v1.1) %%E 2 %%I 2 %%D 3 #-h- crt.r 2220 asc 06-may-82 06:22:26 j (sventek j) %%E 3 %%E 2 %%I 3 #-h- crt.r 2286 asc 24-nov-82 17:06:15 sventek (joseph sventek) %%E 3 #-h- main 869 asc 25-mar-82 07:29:44 v1.1 (sw-tools v1.1) ### CRT Output files a screenfull at a time. DRIVER(crt) character buf(MAXLINE) filedes fd, tt filedes open # function(s) integer i, input, j, mode, nlines integer ctoi, getarg, getlin, prtnl, stmode # function(s) string terml TERMINAL_IN data nlines /22/ data input /NO/ call query("usage: crt [-n] [file] ...") tt = open( terml, READWRITE) if( tt == ERR ) call cant(terml) mode = stmode( tt, RARE) for( i = 1 ; getarg( i, buf, MAXLINE) != EOF ; i = i + 1 ) { if( buf(1) == '-' & buf(2) == EOS ) fd = STDIN else if( buf(1) == '-' ) { j = 2 nlines = max( ctoi(buf,j), 1) next } else { fd = open( buf, READ) if( fd == ERR ) call cant(buf) } input = YES if( prtnl( fd, nlines, tt) == EOF ) break if( fd != STDIN ) call close(fd) } if( input == NO ) call prtnl( STDIN, nlines, tt) DRETURN end %%D 2 #-h- prtnl 729 asc 25-mar-82 07:29:46 v1.1 (sw-tools v1.1) %%E 2 %%I 2 %%D 3 #-h- prtnl 1212 asc 06-may-82 06:20:38 j (sventek j) %%E 3 %%E 2 %%I 3 #-h- prtnl 1267 asc 24-nov-82 17:04:09 sventek (joseph sventek) %%E 3 ### PrtNl Print ``n'' lines at a time from file ``fd''. integer function prtnl( fd, nl, tt) character buf(MAXLINE), c character getch # function(s) filedes fd, tt %%D 2 integer nl, prmpt integer getlin # function(s) %%E 2 %%I 2 integer nl, prmpt, mode integer getlin, gtmode # function(s) %%E 2 %%D 2 string pstr "@r@l[Press SPACE for more]" %%E 2 %%I 2 string rpstr "@r@l[Press SPACE for more]" string pstr "" %%E 2 data prmpt /NO/ prtnl = OK %%I 2 mode = gtmode(tt) # determine mode of unit %%E 2 repeat %%D 2 { if( prmpt == YES ) %%E 2 { %%D 2 call putlin( pstr, tt) prtnl = getch( c, tt) if( prtnl == TERMINAL_EOF ) %%E 2 %%I 2 if( prmpt == YES ) %%E 2 { %%I 2 if (mode != COOKED) # RAW | RARE mode { call putlin(rpstr, tt) # output prompt string prtnl = getch(c, tt) # get the response if (c >= ' ') # if printable, echo it call putch(c, tt) } else { prtnl = prompt(pstr, buf, tt) # use cooked prompt function c = buf(1) # use first character } if( prtnl == TERMINAL_EOF | prtnl == EOF ) { %%E 2 prmpt = NO return(EOF) %%D 2 } %%E 2 %%I 2 } %%E 2 if( c == 'q' | c == 'Q' ) %%D 2 { %%E 2 %%I 2 { %%E 2 prmpt = NO %%I 3 if (mode != COOKED) call putch('@r', tt) %%E 3 return %%I 2 } if (mode != COOKED) # move back over prompt call putch('@r', tt) # move back over prompt %%E 2 } %%D 2 call putch('@r', tt) # move back over prompt } %%E 2 for( j = 1 ; j <= nl ; j = j + 1 ) %%D 2 { %%E 2 %%I 2 { %%E 2 prmpt = YES if( getlin( buf, fd) == EOF ) return call putlin( buf, STDOUT) %%I 2 } %%E 2 } %%D 2 } %%E 2 return end #-h- crt.fmt 957 asc 25-mar-82 07:30:11 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Crt (1) 15-Nov-81 copy files to terminal a screen at a time .sy crt [-n] [file] ... .ds crt is similar to 'cat' except that it prints only n lines (default 22) at a time. After each set of lines are printed, crt will wait for instructions from the user. Hitting a SPACE or RETURN will cause the next n lines to appear, hitting a 'q' (quit) will cause crt to skip over to the next input file (if any), and hitting an end-of-file character (^Z) will cause crt to stop immediately. If no files are specified, or if the filename '-' is given, lines will be read from the standard input. The flag -n may be given, where n specifies the number of lines desired at a time. crt will stop at the end of each file (except the last), as well as after each n lines. .fl none .sa cat .di A message is printed if an input file cannot be opened; further processing is terminated. .au Debbie Scherrer; Modified to use RARE i/o by Dave Martin. .bu %%E 1