File:  [CSRG BSD Unix] / 43BSD / contrib / icon / src / cmd / trim.icn
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:55 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43
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

unix.superglobalmegacorp.com

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