Annotation of 43BSD/contrib/icon/src/cmd/lam.icn, revision 1.1

1.1     ! root        1: #      LAM(1)
        !             2: #
        !             3: #      Laminate files
        !             4: #
        !             5: #      Thomas R. Hicks
        !             6: #
        !             7: #      Last modified 7/28/83
        !             8: #
        !             9: 
        !            10: global fndxs
        !            11: 
        !            12: procedure main(a)
        !            13:    local bufs, i
        !            14:    bufs := list(*a)
        !            15:    fndxs := []
        !            16:    if (*a = 0) | a[1] == "?" then Usage()
        !            17:    every i := 1 to *a do {
        !            18:       if a[i] == "-" then {
        !            19:          a[i] := &input
        !            20:             put(fndxs,i)
        !            21:             }
        !            22:       else if match("-",a[i]) then {
        !            23:          bufs[i] := a[i][2:0]
        !            24:          a[i] := &null
        !            25:          }
        !            26:       else {
        !            27:          if not (a[i] := open(a[i])) then
        !            28:             stop("Can't open ",a[i])
        !            29:          else put(fndxs,i)
        !            30:          }
        !            31:      }
        !            32:    if 0 ~= *fndxs then lamr(a,bufs) else Usage()
        !            33: end
        !            34: 
        !            35: procedure lamr(args,bufs)
        !            36:    local i, j
        !            37:    every i := !fndxs do
        !            38:       bufs[i] := (read(args[i]) | &null)
        !            39:    while \bufs[!fndxs] do {
        !            40:       every j := 1 to *bufs do
        !            41:          writes(\bufs[j])
        !            42:       write()
        !            43:       every i := !fndxs do
        !            44:          bufs[i] := (read(args[i]) | &null)
        !            45:      }
        !            46: end
        !            47: 
        !            48: procedure Usage()
        !            49:    stop("usage: lam file [file | -string]...")
        !            50: end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.