|
|
1.1 root 1: # GCOMP(1)
2: #
3: # Produce complement of file specification
4: #
5: # William H. Mitchell, revised by Thomas Hicks
6: #
7: # Last modified 8/14/84
8: #
9:
10: procedure main(args)
11: local a, dir, ent, files
12: files := mkftbl()
13: while a := get(args) do
14: files[a] := &null
15: every files["." | ".."] := &null
16: files := sort(files)
17: while a := get(files) do
18: write((\a[2],a[1])) # a[1] written iff a[2] has value
19: end
20:
21: procedure mkftbl() # make a table of file names from
22: local line # the current directory
23: line := read(open("echo * .*","rp"))
24: return str2tbl(line,' ')
25: end
26:
27: procedure str2tbl(str,delim) # convert a delmited string into
28: local tbl # a table
29: tbl := table(1)
30: str ? {
31: while tbl[(tab(upto(delim)))] := 1 do
32: move(1)
33: tbl["" ~== tab(0)] := 1
34: }
35: return tbl
36: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.