|
|
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
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.