|
|
1.1 ! root 1: # EDSCRIPT(1) ! 2: # ! 3: # Produce script for ed(1) ! 4: # ! 5: # Ralph E. Griswold ! 6: # ! 7: # Last modified 4/27/83 ! 8: # ! 9: ! 10: procedure main() ! 11: local line, image, object, char ! 12: while line := read() do { ! 13: line ? { ! 14: char := move(1) | {error(line); next} ! 15: image := tab(find(char)) | {error(line); next} ! 16: move(1) ! 17: object := tab(find(char)) | {error(line); next} ! 18: } ! 19: write("g/",xform(image),"/s//",xform(object),"/g") ! 20: } ! 21: write("w\nq") ! 22: end ! 23: ! 24: # process characters that have meaning to ed(1). ! 25: # ! 26: procedure insert() ! 27: static special ! 28: initial special := '\\/^&*[.$' ! 29: suspend { ! 30: tab(upto(special)) || ! 31: "\\" || ! 32: move(1) || ! 33: (insert() | tab(0)) ! 34: } ! 35: end ! 36: ! 37: procedure error(line) ! 38: write(&errout,"*** erroneous input: ",line) ! 39: end ! 40: ! 41: # transform line ! 42: # ! 43: procedure xform(line) ! 44: line ?:= insert() ! 45: return line ! 46: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.