More sync to man(1). Filter was really down to date. Notes: Tue Dec 20 08:06:09 EST 2005 rsc Thanks as always. There were a few instances where you assumed the man page or the usage message in the program was correct, without looking further into the code. Just be aware that neither can be relied upon. Thanks! Russ Reference: /n/sources/patch/applied/man1-sync3 Date: Sun Dec 18 21:18:21 CET 2005 Reviewed-by: rsc --- /sys/src/cmd/primes.c Sun Dec 18 21:15:30 2005 +++ /sys/src/cmd/primes.c Sun Dec 18 21:15:26 2005 @@ -40,7 +40,7 @@ double k, temp, v, limit, nn; if(argc <= 1) { - fprint(2, "usage: primes starting [ending]\n"); + fprint(2, "usage: primes [start [finish]]\n"); exits("usage"); } nn = atof(argp[1]); --- /sys/man/1/filter Sun Dec 18 21:15:49 2005 +++ /sys/man/1/filter Sun Dec 18 21:15:45 2005 @@ -14,9 +14,14 @@ .I "regexp file ]* .PP -.B upas/list add|check +.B upas/list +[ +.B -d +] +.I add|check .I patterns -.I addrfile ... +.I addressfile +[ \&... ] .PP .B upas/deliver .I recipient @@ -30,6 +35,13 @@ ] .PP .B upas/vf +[ +.B -r +] +[ +.B -s +.I savefile +} .SH DESCRIPTION .PP A user may filter all incoming mail by creating @@ -85,6 +97,10 @@ .IR addressfile s against a list of patterns in .IR patternfile . +The +.B -d +option enables debugging output. +.PP Patterns come in four forms: .TP .B ~\fIregular-expression\fP @@ -134,7 +150,7 @@ .I patternfile for each address in the .IR addrssfile 's -that doesh't already match a pattern. +that doesn't already match a pattern. .PP .IR Token , with only one argument, prints to standard output a unique token @@ -169,7 +185,12 @@ .PP .I Vf takes a mail message as standard input, searches for executable -MIME attachments, wraps them in a warning message, and appends +MIME attachments, wraps them in a warning message, saves them in +.I savefile, +when the +.B -s +option is specified, +and appends .B .suspect to any related filenames. .B /sys/lib/mimetype @@ -184,6 +205,11 @@ exists and is executable, each attachment is passed, as a mail message, to the script for further examination. +Giving the +.B -r +option will force +.I Vf +to reject to scan the mail message. .SH FILES .TF /mail/box/*/dead.letter .TP --- /sys/src/cmd/upas/filterkit/deliver.c Sun Dec 18 21:16:11 2005 +++ /sys/src/cmd/upas/filterkit/deliver.c Sun Dec 18 21:16:07 2005 @@ -4,7 +4,7 @@ void usage(void) { - fprint(2, "usage: %s recipient fromaddr-file mbox\n", argv0); + fprint(2, "usage: %s recipient fromfile mbox\n", argv0); exits("usage"); } --- /sys/src/cmd/upas/filterkit/list.c Sun Dec 18 21:16:38 2005 +++ /sys/src/cmd/upas/filterkit/list.c Sun Dec 18 21:16:34 2005 @@ -30,7 +30,7 @@ static void usage(void) { - fprint(2, "usage: %s 'check|add' patternfile addr [addr*]\n", argv0); + fprint(2, "usage: %s [-d] add|check patterns addressfile [...]\n", argv0); exits("usage"); } --- /sys/src/cmd/upas/send/filter.c Sun Dec 18 21:17:08 2005 +++ /sys/src/cmd/upas/send/filter.c Sun Dec 18 21:17:05 2005 @@ -6,6 +6,7 @@ char *subjectarg; char *findbody(char*); +void usage(void); void main(int argc, char *argv[]) @@ -31,13 +32,13 @@ header = 1; body = 1; break; + default: + usage(); } ARGEND Binit(&bin, 0, OREAD); - if(argc < 2){ - fprint(2, "usage: filter rcvr mailfile [regexp mailfile ...]\n"); - exits("usage"); - } + if(argc < 2) + usage(); mp = m_read(&bin, 1, 0); /* get rid of local system name */ @@ -111,6 +112,13 @@ rcvr = cp+1; logdelivery(dp, rcvr, mp); exit(0); +} + +void +usage(void) +{ + fprint(2, "usage: %s [-bh] rcvr mailbox regexp file [regexp file]*\n", argv0); + exits("usage"); } char* --- /sys/src/cmd/upas/vf/vf.c Sun Dec 18 21:17:47 2005 +++ /sys/src/cmd/upas/vf/vf.c Sun Dec 18 21:17:41 2005 @@ -13,6 +13,7 @@ typedef struct Hline Hline; typedef struct Part Part; +static void usage(void); static int badfile(char *name); static int badtype(char *type); static void ctype(Part*, Hdef*, char*); @@ -126,8 +127,10 @@ case 's': savefile = ARGF(); if(savefile == nil) - exits("usage"); + usage(); break; + default: + usage(); }ARGEND; Binit(&in, 0, OREAD); @@ -143,6 +146,13 @@ part(nil); exits(0); +} + +static void +usage(void) +{ + fprint(2, "usage: %s [-r] [-s savefile]\n", argv0); + exits("usage"); } void