# # nr.icn # copyright 1992 Ronald Florence # @(#) version 1.0 (ron@mlfarm.com, 5 May 1992) # # usage (from news- or mail-reader): # | nr "recipe name" "keywords" # procedure main(arg) local indexfile, data_dir, noshow, compress, index, num, seqfile, recipefile, eoh indexfile := getenv("INDEXFILE") | "%INDEXFILE%" data_dir := getenv("RECIPEDIR") | "%DATADIR%" noshow := ["From ", "Message-Id: ", "Received: ", "Return-path: ", "Path: ", "Xref: ", "References: ", "Lines: ", "Expires: ", "Approved: ", "Newsgroups: ", "Subject: ", "Summary: ", "Keywords: ", "Followup-To: ", "Date: ", "Nf-", "From: ", "Distribution: ", "In-Reply-to: ", "Reply-To: ", "NNTP-", "Article-I.D.: ", "Organization: "] compress := "%COMPRESS%" (*arg < 2) & stop("usage: nr \"recipe-name\" \"keywords\" < posted-recipe") index := open(indexfile, "a") | stop("Can't append to recipe index") num := 1 if seqfile := open(data_dir || "seq") then num +:= read(seqfile) { if (*compress > 0) & "pipes" == &features then recipefile := open(compress || " -c > " || data_dir || num || ".Z", "wp") else recipefile := open(data_dir || num, "w") } | stop("Can't write recipe file") every !&input ? { /eoh := *&subject = 0 if \eoh | not match(map(!noshow), map(&subject)) then write(recipefile, tab(0)) } write(index, "Comp-", num, "\t", arg[1], "\t", arg[2]) close(\seqfile) seqfile := open(data_dir || "seq", "w") | stop("Can't update seq file") write(seqfile, num) end