# LAM # # Laminate files # # Thomas R. Hicks # # Last modified 2/1/86 by Ralph E. Griswold # global fndxs procedure main(a) local bufs, i bufs := list(*a) fndxs := [] if (*a = 0) | a[1] == "?" then Usage() every i := 1 to *a do { if a[i] == "-" then { a[i] := &input put(fndxs,i) } else if match("-",a[i]) then { bufs[i] := a[i][2:0] a[i] := &null } else { if not (a[i] := open(a[i])) then stop("Can't open ",a[i]) else put(fndxs,i) } } if 0 ~= *fndxs then lamr(a,bufs) else Usage() end procedure lamr(args,bufs) local i, j every i := !fndxs do bufs[i] := (read(args[i]) | &null) while \bufs[!fndxs] do { every j := 1 to *bufs do writes(\bufs[j]) write() every i := !fndxs do bufs[i] := (read(args[i]) | &null) } end procedure Usage() stop("usage: lam file [file | -string]...") end