%%s 0/0/0 %%d D 1.1 25-Mar-82 12:01:32 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- asplit.r 1787 asc 25-mar-82 07:19:04 v1.1 (sw-tools v1.1) #-h- main 867 asc 25-mar-82 07:18:53 v1.1 (sw-tools v1.1) DRIVER(asplit) character header(5), tag(FILENAMESIZE), buf(MAXLINE), clower, file(FILENAMESIZE) integer getlin, i, getarg, nmatch, out, open, verbos, scline data header/'#', '-', 'h', '-', EOS/ data tag(1)/EOS/ call query("usage: asplit [-tstring] [-v].") verbos = NO for (i=1; getarg(i, buf, MAXLINE) != EOF; i=i+1) if (buf(1) == '-' & clower(buf(2)) == 't') call scopy(buf, 3, tag, 1) else if (buf(1) == '-' & clower(buf(2)) == 'v') verbos = YES else { call putlin(buf, ERROUT) call remark(": invalid argument.") } out = STDOUT while (getlin(buf, STDIN) != EOF) if (nmatch(buf, 1, header) > 0) { call close(out) if (scline(buf, tag, file) == ERR) call cant(buf) out = open(file, WRITE) if (out == ERR) call cant(file) if (verbos == YES) call remark(file) } else call putlin(buf, out) DRETURN end #-h- nmatch 247 asc 25-mar-82 07:18:53 v1.1 (sw-tools v1.1) integer function nmatch(lin, from, pat) character lin(MAXLINE), pat(ARB) integer from, i, j i = from for (j=1; pat(j) != EOS; j = j + 1) { if (lin(i) != pat(j)) { nmatch = 0 return } i = i + 1 } nmatch = i return end #-h- scline 454 asc 25-mar-82 07:18:54 v1.1 (sw-tools v1.1) integer function scline(buf, tag, file) character buf(ARB), tag(ARB), file(ARB), type, c integer i, j for (i=1; buf(i) != ' '; i=i+1) ; # skip over header call skipbl(buf, i) # skip over blanks c = type(buf(i)) for (j=1; c == LETTER | c == DIGIT | c == '.'; j=j+1) { file(j) = buf(i) i = i + 1 c = type(buf(i)) } if (j == 1) scline = ERR else { call scopy(tag, 1, file, j) scline = OK } return end #-h- asplit.fmt 1658 asc 25-mar-82 07:19:05 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Asplit (1) 25-Aug-80 salvage garbaged archive files .sy asplit [-tstring] [-v] .ds asplit reads the standard input file, looking for lines beginning with the archive header flag (#-h-). Upon locating such a line, the next word after the header is used to generate a file name, and all lines read up to the next pseudo-header line are written onto that file. When generating the file name, only the characters found before a left parenthesis are used, if one is found. If the -t switch is used, the string appended to the -t is appended to each file name before the file is created, thus permitting a fixed tag string to be formatted into the file name. If the -v option is specified, the name of each file is reported on ERROUT as it is opened. Any lines found at the beginning of the file before the first pseudo-header line is copied to standard output. asplit is commonly used to salvage an archive which has been garbaged, or to take a monster fortran source program file and break it up into subroutines. A script file (breakup) may be found on the tools binary directory which will cause each subprogram of the form "subroutine snarf" or "... function snarf" to be placed on a file of the name "snarf.qq". The only side effect of this transformation is that the source will be in lower case, and may be remedied by modifying the file breakup. .fl none .sa ar - file archiver: the -s switch does essentially the same thing as asplit, except that it tries to rebuild the source file as a new archive, which does not always work in pathological cases. .br sepfor - split FORTRAN programs into multiple files .au Joe Sventek .bu %%E 1