4.3BSD/usr/contrib/icon/src/cmd/roffcmds.icn

#	ROFFCMDS(1)
#
#	Tabulate n/troff commands and defined strings
#
#	Ralph E. Griswold
#
#	Last modified 7/12/83
#

procedure main()
   local line, con, des, y
   con := table(0)
   des := table(0)
   while line := read() do {
      line ? if tab(any('.\'')) then
         con[tab(any(~'. \t\\')) || (tab(upto(' ') | 0))] +:= 1
      line ? while tab(find("\\*") + 2) do
         des[if ="(" then move(2) else move(1)] +:= 1
      }
   con := sort(con)
   write("Controls:\n")
   every y := !con do
      write(y[1],"\t",y[2])
   des := sort(des)
   write("\nDefined strings:\n")
   every y := !des do
      write(y[1],"\t",y[2])
end