Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1exp 11/4/83; site ihu1g.UUCP Path: utzoo!linus!philabs!cmcl2!floyd!harpo!eagle!mhuxl!ihnp4!ihu1g!fish From: fish@ihu1g.UUCP (Bob Fishell) Newsgroups: net.jokes.d Subject: Home-grown de-rotator Message-ID: <115@ihu1g.UUCP> Date: Fri, 30-Dec-83 15:23:36 EST Article-I.D.: ihu1g.115 Posted: Fri Dec 30 15:23:36 1983 Date-Received: Sat, 31-Dec-83 11:44:26 EST Organization: AT&T Bell Labs, Naperville, IL Lines: 37 If any of you are disappointed with Caesar, or if you need something to decode saved jokes, I have a little program that works half-way decent and runs very fast. Here it is: #include #include #define begin { #define end; } main () /* does a 13-character rotation on alpha strings and copies the result to std out. */ begin short c; while ((c = getchar())!= EOF) begin if (isupper(c)) /* A-Z? */ begin c = ( (c - 'A' + 13) % 26) + 'A'; end; if (islower(c)) /* a-z? */ begin c = ( (c - 'a' + 13) % 26) + 'a'; end; putchar(c); end; end; The program can be used for both rotation and derotation. Bugs: rotates unrotated portions of the file. "C" purists will flame about the begin/end; substitutions for those thq qnza(rot13), illegible little braces...