#-h- whereis.r 1575 asc 20-may-81 02:01:25 [105,002] #-h- main 1513 asc 20-may-81 01:45:49 [105,002] DRIVER(whereis) integer desc, n, j, i, ddesc integer getarg, getpat, opendr, gdrprm, matchc, match character temp(FILENAMESIZE), pat(MAXPAT), file(FILENAMESIZE), device(FILENAMESIZE), entry(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, file, FILENAMESIZE) == EOF) call strcpy(sysdev, file) call mklocl(file, device) call concat(device, zz, file) if (opendr(file, desc) != OK) call cant(file) while (gdrprm(desc, temp) != EOF) { n = matchc(temp, dotdir) if (n > 0) { j = 1 call stcopy(device, 1, file, j) call chcopy(LBRACK, file, j) for (i=1; i <= 3; i=i+1) call chcopy(temp(i), file, j) call chcopy(COMMA, file, j) for (i=4; i <= 6; i=i+1) call chcopy(temp(i), file, j) call chcopy(RBRACK, file, j) call mkpath(file, temp) if (opendr(temp, ddesc) == ERR) { call putlin(temp, ERROUT) call remark(": cannot open directory.") } else { while (gdrprm(ddesc, entry) != EOF) { if (match(entry, pat) == YES) { call putlin(temp, STDOUT) call putch(SLASH, STDOUT) call putlin(entry, STDOUT) call putch(NEWLINE, STDOUT) } } call closdr(ddesc) } } } DRETURN end #-h- whereis.rof 722 asc 20-may-81 02:01:26 [105,002] .in 0 .rm 70 .he /WHEREIS/20-May-81/WHEREIS/ .fo //-#-/ .bp 1 .in +7 .ti -7 NAME whereis - search for file matching regular expression .ti -7 SYNOPSIS whereis pat [anchor] .ti -7 DESCRIPTION `whereis' searches for the specified pattern (regular expression) in all of the directories of the current disk. If the anchor expression is specified (it must be of the form /ddn, where dd is the disk name and n is the unit number), the search will be performed on the directories of that disk. The files matching the pattern are output on standard output, in a fully resolved pathname format. .ti -7 AUTHORS Joe Sventek wrote whereis. .ti -7 SEE ALSO .nf ls - directory lister find - for regular expression syntax .fi