%%s 0/0/0 %%d D 1.1 26-Mar-82 12:37:05 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- whereis.r 1990 asc 25-mar-82 07:36:21 v1.1 (sw-tools v1.1) #-h- main 1485 asc 25-mar-82 07:36:05 v1.1 (sw-tools v1.1) DRIVER(whereis) integer desc, n, j, i, ddesc, pat(MAXPAT) integer getarg, getpat, opendr, gdrprm, indexs, match character temp(FILENAMESIZE), file(FILENAMESIZE), device(FILENAMESIZE) string usestr "usage: whereis pat [anchor]" string sysdev "/sy0" string zz "[0,0]" string dotdir ".dir" call query(usestr) if (getarg(1, temp, FILENAMESIZE) == EOF) call error(usestr) call fold(temp) if (getpat(temp, pat) == ERR) call error("illegal pattern") if (getarg(2, temp, FILENAMESIZE) == EOF) call gwdir(temp, LOCAL) call mklocl(temp, device) if (index(device, '[') == 0) # do whole device { doall = YES call concat(device, zz, temp) } else { doall = NO call strcpy(device, temp) } call mkpath(temp, file) if (opendr(file, desc) != OK) call cant(file) if (doall == NO) call dspfil(desc, file, pat) else { while (gdrprm(desc, temp) != EOF) { n = indexs(temp, dotdir) if (n > 0) { j = 1 call stcopy(device, 1, file, j) call chcopy('[', file, j) for (i=1; i <= 3; i=i+1) call chcopy(temp(i), file, j) call chcopy(',', file, j) for (i=4; i <= 6; i=i+1) call chcopy(temp(i), file, j) call chcopy(']', file, j) call mkpath(file, temp) if (opendr(temp, ddesc) == ERR) { call putlin(temp, ERROUT) call remark(": cannot open directory.") } else call dspfil(ddesc, temp, pat) } } call closdr(desc) } DRETURN end #-h- dspfil 359 asc 25-mar-82 07:36:06 v1.1 (sw-tools v1.1) subroutine dspfil(desc, direct, pat) integer desc, pat(MAXPAT) character direct(ARB), entry(FILENAMESIZE) integer gdrprm, match while (gdrprm(desc, entry) != EOF) if (match(entry, pat) == YES) { call putlin(direct, STDOUT) call putch('/', STDOUT) call putlin(entry, STDOUT) call putch('@n', STDOUT) } call closdr(desc) return end #-h- whereis.fmt 680 asc 25-mar-82 07:36:23 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Whereis (1) 20-May-81 search for file matching regular expression .sy whereis pat [anchor] .ds `whereis' searches for the specified pattern (regular expression) in the search path defined by anchor. If no anchor is specified, the current directory is searched. If a device and directory are specified, only that directory is searched. If only a device is specified, all of the directories on that disk are searched in the order in which they appear in [0,0]. The files matching the pattern are output on standard output, in a fully resolved pathname format. .fl .sa .nf ls - directory lister find - for regular expression syntax .fi .di .au Joe Sventek .bu %%E 1