%%s 0/0/0 %%d D 1.1 25-Mar-82 12:16:09 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 #-h- ul.r 1935 asc 25-mar-82 09:02:14 v1.1 (sw-tools v1.1) #-h- uls 498 asc 25-mar-82 09:01:48 v1.1 (sw-tools v1.1) ### Ul Convert backspaces into multiple lines DRIVER(ul) character buf(MAXLINE) integer getarg, open integer i call query( "usage: ul [file] ..." ) for( i = 1 ; ; i = i + 1 ) { if( getarg( i, buf, MAXLINE) == EOF ) { if( i != 1 ) break int = STDIN } else if( buf(1) == '-' & buf(2) == EOS ) int = STDIN else { int = open( buf, READ) if( int == ERR ) call cant(buf) } call overs(int) if( int != STDIN ) call close(int) } DRETURN end #-h- overs 951 asc 25-mar-82 09:01:51 v1.1 (sw-tools v1.1) ### Overs Convert backspaces into multiple lines. subroutine overs(fd) character getch # function(s) character c, lin1(MAXLINE), lin2(MAXLINE) filedes fd integer index # function(s) integer bspcnt, col, i lin1(1) = EOS lin2(1) = EOS col = 1 bspcnt = 0 for( c = getch( c, fd) ; c != EOF ; c = getch( c, fd) ) { if( c == '@n' ) { for( i = 1 ; lin1(i) != EOS ; i = i + 1 ) if( lin1(i) == '_' ) { lin1(i) = lin2(i) lin2(i) = '_' } call putlin( lin1, STDOUT) if( index( lin2, '_') != 0 ) { call putc(CR) call putlin( lin2, STDOUT) } call putc('@n') col = 1 bspcnt = 0 lin1(1) = EOS lin2(1) = EOS } else if( c == BACKSPACE ) bspcnt = bspcnt + 1 else if( bspcnt > 0 ) { lin2( col - bspcnt ) = c bspcnt = bspcnt - 1 } else { call inschr( ' ', lin2, col) call inschr( c, lin1, col) col = col + 1 } } return end #-h- inschr 267 asc 25-mar-82 09:01:52 v1.1 (sw-tools v1.1) ### InsChr Insert a character into `str' at position `i'. subroutine inschr( c, str, j) character c character str(MAXLINE) character buf(MAXLINE) integer i, j buf(1) = EOS call scopy( str, j, buf, 1) call scopy( buf, 1, str, j + 1 ) str(j) = c return end #-h- ul.fmt 745 asc 25-mar-82 09:02:17 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Ul (1) 18-Aug-81 convert backspaces into multiple lines for "terminals" .sy ul [file] ... .ds ul (underline) converts lines with BACKSPACE-UNDERLINE pairs into two lines; one with the text and one with only BLANK and UNDERLINE characters. These two lines are output separated by a CR with no associated LF. This approach works with printing terminals and some line printers, most notably Printronix and Trilog. If no files are given, or the filename '-' appears, input is taken from the standard input. .fl .sa lpr - queue file to line printer .br os - process overstrikes for "printers" .di A message is printed if an input file cannot be opened; further processing is terminated. .au Paul Johnstone (Hughes Aircraft) .bu %%E 1