%%s 0/0/0 %%d D 1.1 25-Mar-82 12:04:01 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- detab.r 1479 asc 25-mar-82 07:38:05 v1.1 (sw-tools v1.1) #-h- main 737 asc 25-mar-82 07:37:52 v1.1 (sw-tools v1.1) ## driver for detab tool DRIVER(detab) character buf(MAXLINE) integer open, getarg, length, alldig integer tabs(MAXLINE), int, i, k, l call query("usage: detab [...] [+] [file] ...") call argtab(buf) # fetch tab info into buf call settab(buf, tabs) # set tab stops int = ERR for (i=1; getarg(i, buf, MAXLINE) != EOF; i=i+1) { if (buf(1) == '+' | alldig(buf) == YES) #ignore flags next if (buf(1) == '-' & buf(2) == EOS) #read from standard input int = STDIN else int = open(buf, READ) if (int == ERR) call cant(buf) call detab (tabs, int) if (int != STDIN) call close(int) } if (int == ERR) #no files read call detab(tabs, STDIN) DRETURN end #-h- detabs 596 asc 25-mar-82 07:37:53 v1.1 (sw-tools v1.1) ## detab - convert tabs to equivalent number of blanks subroutine detab (tabs, int) integer int character getch character c integer tabs(ARB) integer tabpos integer col col = 1 while (getch(c, int) != EOF) if (c == '@t') repeat { call putc(' ') col = col + 1 if (tabpos(col, tabs) == YES) break } else if (c == '@n') { call putc('@n') col = 1 } else { call putc(c) col = col + 1 } return end #-h- detab.fmt 652 asc 25-mar-82 07:38:07 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Detab (1) 12-Aug-81 convert tabs to spaces .sy detab [...] [+] [file] ... .ds detab converts tab characters (control-i) to equivalent strings of blanks. Tab stops are indicated by ... (default 8, 16, ...), while + indicates tab stops every columns. Thus the command .ti +3 detab 5 21 +5 supplies blanks for tabs terminating at column positions 5, 21, 26, etc. If no files are specified, the standard input is read. An isolated minus sign also indicates the standard input. .sa entab .br lpr .au Original from Kernighan & Plauger's 'Software Tools', with modifications by Dennis Hall and Debbie Scherrer. .bu %%E 1