Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!harpo!floyd!clyde!ihnp4!inuxc!pur-ee!uiucdcs!parsec!ctvax!uokvax!andree From: andree@uokvax.UUCP Newsgroups: net.news Subject: Re: very few jokes in net.jokes - (nf) Message-ID: <4438@uiucdcs.UUCP> Date: Sat, 10-Dec-83 22:52:15 EST Article-I.D.: uiucdcs.4438 Posted: Sat Dec 10 22:52:15 1983 Date-Received: Tue, 13-Dec-83 02:29:37 EST Lines: 112 #R:aecom:-29000:uokvax:4100002:000:4276 uokvax!andree Dec 10 00:02:00 1983 After seeing the comments about fixing news to throw away non-funny jokes in net.jokes, I decided that the filter needs to be on the receiving end, not the sending end. I immediately made a sweeping generalization, which resulted in the following proposal: 1) Fix news to run all messages through a user-specified filter, receiving zero or more messages from the other end that are then run through the standard interface. Zero messages implies this one was thrown away, more than one implies that the tool in question de-digested an ARPANet digest. Notes: news should allow arbitrary pipes for the filter; a similar hack in mail (or Mail) would also be useful. 2) A new tool for use with mail/news. Tentative manual page follows. NAME badmail - filter mail or news articles that the user doesn't wish to see. SYNOPSIS badmail [-r] [-c command] [file] DESCRIPTION badmail is used to filter news or mail files. It expects one or more letters on standard in, and selectively copies or does not copy the letters to standard out. It's argument is either a file name, or a command (with the -c option). The command consists of a valid line from the file, and should probably be quoted to avoid bad side effects with the shell. The file consists of one or more lines. Each line specifies a condition that a letter can meet. If the letter meets this condition, it is instantly discarded. Optionally, a `^' can precede the condition, which causes the letter to be instantly passed to standard output should it satisfy the condition. Should a letter reach the end of the file, it is normally passed to standard output. The -r flag causes such letters to be discarded instead. Valid command lines are: f site!name true if the letter is from site!name site! implies any user at site name implies local user a site!name same as f s string true if string is in the subject line t string true if string is in the text of the letter < number true if letter has fewer than number lines > number true if the letter has greater than number lines ! cond true if following condition is false * always true ^ cond causes the letter to be accepted instead of rejected if the condition is true. EXAMPLES badmail -r -c "^f ea!mwm" # read all mail from ea!mwm only badmail -c "!f ea!mwm" # again, read all mail from ea!mwm badmail -c "f ea!mwm" # read all mail NOT from ea!mwm An example file might be < 1 # filter out null mail ^< 20 # I'll look at anything less than a page long f klonquest # throw out mail from a local user f rlgvax!joe # and from rlgvax!joe ^f rlgvax! # accept all other mail from rlgvax ^s rot # I like dirty jokes (hehehe) t lightbulb # but no more lightbulb jokes! s long-names # or anything else on long names! ^f ihxyzzy!jane # accept mail from ihxyzzy!jane !f ucbvax! # now, throw out anything not from ucbvax Note that this example is a hodge-podge of things that would go in various files; you probably wouldn't use it in a real file. It just illustrates some of the techniques you can use. An important consideration is that `!' and `^' are NOT the same thing. A condition by itself causes anything that meets the condition to be thrown out; everything else is passed on for further consideration. That same condition preceded by `^!' causes anything that meets the condition to be passed on for further consideration; everything else is thrown out. BUGS It really should allow multiple conditions on a line, so you can specify `anything from so&so and > 100 lines gets thrown out.' ---------- Note: This looks like something both easy and usefull. I'd do it myself, except we run notes, and I don't have access to the source.