Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!hsi!mlfarm!ron From: ron@mlfarm.com (Ronald Florence) Newsgroups: comp.lang.icon Subject: Message conventions Message-ID: <675@mlfarm.com> Date: 2 Jan 91 11:57:01 GMT Sender: ron@mlfarm.com Distribution: comp Organization: Maple Lawn Farm, Stonington, CT Lines: 94 Paul Abrahams writes: > I've noticed that in many of the postings to icon-group, the messages have > excerpts from previous messages preceded by "> ". Could anyone let me know > what software you're using to get this effect, and how you're using it? > Thanks. The convention is used by many mailers and news readers, including the Gnu Emacs mail readers, Elm, rn, and others. Here is a short icon program which will accomplish the same thing. You can either pipe a news-article or mail-item to `reply' directly from your mail or news reader, or save the news-article or mail-item in a file and run `reply' with the file as input. You will have to customize edstr and host to suit your editor and system, and may have to customize the addressing conventions at the end of the code. This should work for Unix or ms-dos (the ms-dos is untested). It may be useful on VMS or other operating systems with some modifications. ---------------------------[reply.icn]--------------------------- # reply.icn # ron@mlfarm.com, 2 Jan 91 # usage: reply < news-article or mail-item # # Configure edstr and host as needed for your editor and mail feed. procedure main() find("UNIX",&features) & { console := "/dev/tty" tmpfile := "/tmp/" } find("MS-DOS",&features) & { console := "CON" tmpfile := "" } &clock ? while tab(upto(&digits)) do tmpfile ||:= tab(many(&digits)) tmpfile ||:= ".tmp" edstr := "vi " || tmpfile || " < " || console host := "mlfarm.com" eoh := 0 reply := open(tmpfile, "w") | stop("reply: cannot open temp file") while s := read() do { eoh = 1 & { write(reply, " > ", s) next } (match("From: ", s) | match("Reply-To: ", s)) & { start := s[find(" ",s)+1:0] if find("<", s) then { fullname := trim(start ? tab(upto("<"))) address := s[find("<",s)+1:find(">",s)] } else { address := trim(start ? tab(upto("(")) | tab(0)) fullname := s[find("(",s)+1:find(")",s)] } quoter := (\fullname | address) } match("Date: ", s) & date := s[7:0] match("Message-Id: ", s) & id := s[find("<",s):find(">",s)+1] match("Subject: ", s) & subject := s match("Newsgroup: ", s) & newsgroup := (s ? tab(upto(",")) | tab(0)) (\address & not any(&ascii, s)) & { eoh := 1 write(reply, "In-reply-to: ", quoter, "'s message of ", date); \subject & write(reply, subject) \newsgroup & write(reply, newsgroup) write(reply, "\nIn ", id, ", ", quoter, " writes:\n") } } system(edstr) stdin := open(console, "r") writes("Send y/n? ") upto('nN',read(stdin)) & { remove(tmpfile) stop("Reply aborted.") } find("@",address) & address ? { name := tab(upto("@")) move(1) address := (tab(upto(" ")) | tab(0)) || "!" || name } address ||:= "@" || host mailstr := "mail " || address || " < " || tmpfile system(mailstr) write("Reply sent to " || address) remove(tmpfile) end -------------------------------[end]------------------------------ -- Ronald Florence ron@mlfarm.com