%%s 0/0/0 %%d D 1.1 25-Mar-82 12:05:59 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- fd.r 1959 asc 25-mar-82 07:55:06 v1.1 (sw-tools v1.1) #-h- defns 133 asc 25-mar-82 07:54:49 v1.1 (sw-tools v1.1) # definitions for fd, the in-memory sorted directory lister define(RIGHT_MARGIN,80) define(MEM_SIZE,5000) define(AVE_TOK_SIZE,12) #-h- main 1680 asc 25-mar-82 07:54:51 v1.1 (sw-tools v1.1) # main routine for d - in-memory sorted directory lister DRIVER(d) integer level, desc, depth, ptr(MAXDIRECTS), j, i, status, nxtcol, junk, pat(MAXPAT) integer opendr, getpat, gdrprm, length, match, getarg, gtftok, imput, imget character ppath(FILENAMESIZE), file(FILENAMESIZE), buf(FILENAMESIZE), obuf(MAXLINE) DS_DECL(mem, MEM_SIZE) pointer sarray pointer iminit string defpat "%" call query("usage: fd [path] ...") level = 0 call inpack(nxtcol, RIGHT_MARGIN, obuf, STDOUT) repeat { level = level + 1 status = getarg(level, ppath, FILENAMESIZE) if (status == EOF & level > 1) break else if (status == EOF) call gwdir(ppath, PATH) sarray = iminit(MEM_SIZE, AVE_TOK_SIZE) if (sarray == LAMBDA) call error("Error initializing in-memory sort.") call strcpy(defpat, file) if (opendr(ppath, desc) == ERR) { call strcpy(ppath, buf) call mkpath(buf, ppath) call exppth(ppath, depth, ptr, buf) j = ptr(depth) junk = gtftok(ppath, j, file) j = ptr(depth) ppath(j) = EOS if (opendr(ppath, desc) == ERR) call cant(ppath) } call fold(file) if (getpat(file, pat) == ERR) call error("Illegal pattern.") while (gdrprm(desc, file) != EOF) { i = length(file) + 1 file(i) = '@n' file(i+1) = EOS call fold(file) if (match(file, pat) == YES) { file(i) = EOS if (imput(sarray, file) == ERR) { call remark("Too many files for in-memory sort.") break } } } call closdr(desc) call imsort(sarray) while (imget(sarray, file) != EOF) call dopack(file, nxtcol, RIGHT_MARGIN, obuf, STDOUT) call flpack(nxtcol, RIGHT_MARGIN, obuf, STDOUT) } DRETURN end #-h- fd.fmt 530 asc 25-mar-82 07:55:07 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Fd (1) 11-Mar-82 fast directory list in sort order .sy fd [path] ... .ds `fd' lists the files matching the specified pattern in sort order, packed in 5 columns across the page. The packing occurs regardless of whether standard output is a terminal or not, in contrast to the actions of `ls'. If no `path' arguments are specified, all files in the current working directory are listed. The forms of `path' are identical to those for `ls'. .fl .sa ls - general directory listing tool .di .au Joe Sventek .bu %%E 1