Saving rotated jokes unrotated

Sean Casey sean at ukma.UUCP
Sat May 25 10:07:36 AEST 1985


In article <184 at weitek.UUCP> neal at weitek.UUCP (Neal Bedard) writes:
>
>	The one way I have found thus far to get at joke rotation is to
>invoke `postnews' (on our 4.2 Bsd site) and go thru the motions of posting
>text to net.jokes. YECCHH!!!...
>...Voila! rotated joke saved in readable form.
>Maybe someone knows a better way. I'm listening...

I whipped this filter together in about 10 minutes.  It simply does ROT13
rotation.  It could probably be done better.

Compile with:	cc -O -o unrot unrot.c

------------------------- CUT HERE -------------------------------------
/*
 *	unrot.c
 *
 *	Simple filter to unrotate text which has been encrypted
 *	with rot13 (caesar) encryption.
 *
 *	Sean Casey, 1985
 *
 */

#include <stdio.h>

main()

{
	register int c;
	while ((c = getchar()) != EOF) {
		if ( c >= 'A' && c <= 'Z') {
			c += 13;
			if ( c > 'Z' )
				c -= 26;
		} else {
			if ( c >= 'a' && c <= 'z') {
				c += 13;
				if ( c > 'z' )
					c -= 26;
			}
		}
		putchar(c);
	}
}
------------------------------ CUT HERE ------------------------------------

-- 

-  Sean Casey				UUCP:	{cbosgd,anlams,hasmed}!ukma!sean
-  Department of Mathematics		ARPA:	ukma!sean at ANL-MCS.ARPA	
-  University of Kentucky



More information about the Comp.unix mailing list