Annotation of 43BSD/contrib/icon/src/cmd/trim.icn, revision 1.1.1.1

1.1       root        1: #      TRIM(1)
                      2: #
                      3: #      Trim lines
                      4: #
                      5: #      Ralph E. Griswold
                      6: #
                      7: #      Last modified 7/10/83
                      8: #
                      9: 
                     10: procedure main(x)
                     11:    local n, i, pad, s, line
                     12:    n := 80
                     13:    pad := 0
                     14:    i := 0
                     15:    while i < *x do {
                     16:       s := x[i +:= 1] | break
                     17:       if s == "-f" then pad := 1
                     18:       else if not(n := (0 <= integer(s))) then stop("usage: trim [n] [-f]")
                     19:       }
                     20:    while line := read() do {
                     21:       line := line[1+:n]
                     22:       line := trim(line)
                     23:       if pad = 1 then line := left(line,n)
                     24:       write(line)
                     25:       }
                     26: end

unix.superglobalmegacorp.com

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