# GCOMP(1) # # Produce complement of file specification # # William H. Mitchell, revised by Thomas Hicks # # Last modified 8/14/84 # procedure main(args) local a, dir, ent, files files := mkftbl() while a := get(args) do files[a] := &null every files["." | ".."] := &null files := sort(files) while a := get(files) do write((\a[2],a[1])) # a[1] written iff a[2] has value end procedure mkftbl() # make a table of file names from local line # the current directory line := read(open("echo * .*","rp")) return str2tbl(line,' ') end procedure str2tbl(str,delim) # convert a delmited string into local tbl # a table tbl := table(1) str ? { while tbl[(tab(upto(delim)))] := 1 do move(1) tbl["" ~== tab(0)] := 1 } return tbl end