# TRIM # # Trim lines # # Ralph E. Griswold # # Last modified 7/10/83 # procedure main(x) local n, i, pad, s, line n := 80 pad := 0 i := 0 while i < *x do { s := x[i +:= 1] | break if s == "-f" then pad := 1 else if not(n := (0 <= integer(s))) then stop("usage: trim [n] [-f]") } while line := read() do { line := line[1+:n] line := trim(line) if pad = 1 then line := left(line,n) write(line) } end