File:  [Research Unix] / researchv10dc / cmd / icon / ipl / source / tablc.icn
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 3 months ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Dan Cross

#	TABLC
#
#	Tabulate characters
#
#	Ralph E. Griswold
#
#	Last modified 4/29/86
#

procedure main(x)
   local ccount, unique, order, i, s, a, pair, rwidth
   unique := 0				# switch to list unique usage only
   order := 3				# alphabetical ordering switch
   i := 0
   while i < *x do {
      s := x[i +:= 1] | break
      case s of {
         "-a":  order := 3
         "-n":  order := 4
         "-u":  unique := 1
         default:  Usage()
         }
      }
   ccount := table(0)			# table of characters
   while ccount[reads()] +:= 1
   a := sort(ccount,order)
   if unique = 1 then {
      while s := get(a) do
	 if get(a) = 1 then write(s)
      }
   else {
      rwidth := 0
      every rwidth <:= *!a
      while s := get(a) do
         write(left(image(s),10),right(get(a),rwidth))
      }
end

procedure Usage()
   stop("usage:  tablc [-a -n -u]")
end

unix.superglobalmegacorp.com

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