%%s 3/3/106 %%d D 1.2 30-Jul-83 09:18:01 tools 2 1 %%c Removed trailing periods from quoted strings. %%s 0/0/0 %%d D 1.1 27-Mar-82 15:04:00 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- whereis.r 1814 asc 25-mar-82 09:42:49 v1.1 (sw-tools v1.1) #-h- main 1533 asc 25-mar-82 09:42:42 v1.1 (sw-tools v1.1) %%E 2 %%I 2 #-h- whereis.r 1818 asc 30-jul-83 09:17:46 tools (lblh csam sventek) #-h- main 1532 asc 30-jul-83 09:16:08 tools (lblh csam sventek) %%E 2 define(MAX_DEPTH,20) DRIVER(whereis) character arg(FILENAMESIZE), file(FILENAMESIZE), dnam(FILENAMESIZE, MAX_DEPTH) integer pat(MAXPAT) integer i, j, k, desc(MAX_DEPTH), depth integer getarg, opendr, gdrprm, equal, getpat, match string slashs "/" string remstr "Cannot open directory: " string dotdir ".dir@n" string usestr "usage: whereis pat [anchor]" call query(usestr) if (getarg(1, arg, FILENAMESIZE) == EOF) call error(usestr) call fold(arg) if (getpat(arg, pat) == ERR) { call putlin(arg, ERROUT) %%D 2 call error(": illegal pattern.") %%E 2 %%I 2 call error(": illegal pattern") %%E 2 } else if (getarg(2, arg, FILENAMESIZE) == EOF) call gwdir(arg, LOCAL) depth = 1 call mkpath(arg, file) j = length(file) if (file(j) != '/') call concat(file, slashs, file) call scopy(file, 1, dnam(1,1), 1) if (opendr(dnam(1,1), desc(1)) == ERR) call cant(arg) while (depth > 0) if (gdrprm(desc(depth), file) == EOF) { call closdr(desc(depth)) depth = depth - 1 } else if (index(file, '/') == 0) { j = length(file) + 1 call chcopy('@n', file, j) if (match(file, pat) == YES) call outlin(dnam(1,depth), file, STDOUT) } else { j = depth + 1 call concat(dnam(1,depth), file, dnam(1,j)) k = index(file, '/') call scopy(dotdir, 1, file, k) if (match(file, pat) == YES) call outlin(dnam(1,depth), file, STDOUT) if (opendr(dnam(1,j), desc(j)) != ERR) { depth = depth + 1 } else { call putlin(remstr, ERROUT) call remark(dnam(1,j)) } } DRETURN end #-h- outlin 135 asc 25-mar-82 09:42:43 v1.1 (sw-tools v1.1) subroutine outlin(dir, file, int) character dir(ARB), file(ARB) integer int call putlin(dir, int) call putlin(file, int) return end #-h- whereis.fmt 962 asc 25-mar-82 09:42:50 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Whereis (1) 2-May-81 locate file in tree based on partial pathname .sy whereis pat [anchor] .ds `whereis' recursively scans a directory tree looking for the regular expression given as the first argument. If no `anchor' argument is supplied, `whereis' starts looking in the current directory and throughout the directory tree descending from the current directory. If `anchor' is specified, the search starts at that directory. Valid patterns are the same as those for `ls'. The output from `whereis' on standard output are fully resolved pathnames, complete with device information. It should be noted that a valid `anchor' argument is "/", which indicates to `whereis' that it should start looking in the "root" directory of the current disk, or "/dba0" to force it to start looking in the "root" directory for dba0:. .fl none .sa .nf ls - directory lister find - find pattern, for regular expression syntax .fi .di .au Joe Sventek .bu %%E 1