|
|
BSD 4.3
# TRIM(1)
#
# 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
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.