File:  [CSRG BSD Unix] / 43BSD / contrib / icon / src / cmd / edscript.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

#	EDSCRIPT(1)
#
#	Produce script for ed(1)
#
#	Ralph E. Griswold
#
#	Last modified 4/27/83
#

procedure main()
   local line, image, object, char
   while line := read() do {
      line ? {
         char := move(1) | {error(line); next}
         image := tab(find(char)) | {error(line); next}
         move(1)
         object := tab(find(char)) | {error(line); next}
         }
      write("g/",xform(image),"/s//",xform(object),"/g")
   }
   write("w\nq")
end

#  process characters that have meaning to ed(1).
#
procedure insert()
   static special
   initial special := '\\/^&*[.$'
   suspend {
      tab(upto(special)) ||
      "\\" ||
      move(1) ||
      (insert() | tab(0))
      }
end

procedure error(line)
   write(&errout,"*** erroneous input: ",line)
end

#  transform line
#
procedure xform(line)
   line ?:= insert()
   return line
end

unix.superglobalmegacorp.com

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