[svlug] Install fest questions.

Seth David Schoen schoen at uclink4.berkeley.edu
Fri Nov 13 10:24:20 PST 1998


Rick Moen writes:

> Does anyone have any tips about how one might use procmail to twit-filter
> messages with .sigs over a reasonable length, e.g., five or so lines?

You might find this useful for integration into procmail (it exits
successfully if it finds in the input the line "-- " followed by more than
five other lines).

Unfortunately, this won't work well in conjunction with lists that add
text after a .signature -- like this one.  I don't know exactly how you'd
deal with that situation -- you could modify this to reset the count when
a new "-- " is encountered, in order to find whether there is _any_
.signature of more than five lines.  (This could be left as an exercise
for the reader.)

/* cut here */
#include <stdio.h>

int main(void) {
char q;
int STATE = 0; /* FSM: 0 = ^, 1 = ^-, 2 = ^--, 3 = ^-- , 4 = ^-- $, ... */
while(1) {
	switch (q=getchar()) {
		case EOF:
			exit (STATE > 9);
		case '-':
			if ((STATE == 0) || (STATE == 1)) STATE++;
			if (STATE == 3) STATE = 0;
			break;
		case ' ':
			if (STATE == 3) STATE = 0;
			if (STATE == 2) STATE++;
			break;
		case '\n':
			if (STATE >= 3) STATE++;
			else STATE = 0;
			break;
		default:
			if (STATE <= 3) STATE = -1;
		}
	
	putchar(q);
	}
}
/* cut here */

-- 
   Seth David Schoen L&S '01 (undeclared) / schoen at uclink4.berkeley.edu
He said, "This is what the king who will reign over you will do."  And they
said, "Nay, but we will have a king over us, that we also may be like all the
nations." (1 Sam 8)  http://ishmael.geecs.org/~sigma/   http://www.loyalty.org/

--
echo "unsubscribe svlug" | mail majordomo at svlug.org
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ to unsubscribe



More information about the svlug mailing list