Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site felix.UUCP Path: utzoo!linus!philabs!cmcl2!floyd!harpo!decvax!ittvax!dcdwest!sdcsvax!bmcg!felix!tom From: tom@felix.UUCP Newsgroups: net.jokes.d Subject: How to Rotate a Joke Responses Message-ID: <232@felix.UUCP> Date: Tue, 10-Apr-84 09:49:51 EST Article-I.D.: felix.232 Posted: Tue Apr 10 09:49:51 1984 Date-Received: Fri, 13-Apr-84 01:35:23 EST Organization: FileNet Corp., Costa Mesa, Ca. Lines: 85 --- Several weeks ago I asked how to rotate a joke. The response was overwhelming. Thanks. Here are a few of the replies for anyone interested. --- Here's how to rotate a joke: Simple rot 13 is easily done with the "tr" program as follows: tr a-zA-Z n-za-mN-ZA-M < joke > rotated joke To avoid typing all of that in every time, you can put the above line in a file called "rot13" somewhere in your path and do a "chmod +x rot13" to make it executable. Alternatively, if you are using the c shell you can put the following line in the ".cshrc" file in your home directory: alias rot13 tr a-zA-Z n-za-mN-ZA-M Thereafter, you can rotate the contents of file "a" into file "b" by typing: rot13 b ---- Here is C shell script to rotate a file, it takes one argument (source file). You can redirect the output to another file. # Script to rotate a file (by 13) tr A-Za-z N-ZA-Mn-za-m < $argv Type this script and name it anything you want. Give it execute permission (chmod +x). For example: If you named it "rot", and you had a file called "joke", you would use it like this.... rot joke > joke.rotated The file "joke.rotated" will contain the rotated joke. Then this file can be posted to the net. --- I'm mailing my rot13 source program which is designed to rotate whatever you have in a file called: jj and send the output to the screen (unless you redirect it). This is good to rotate a joke as well as unrotating it Just remembre to have the joke in a file called jj. Here is the program #include main() { FILE *fp; char c,z; if((fp = fopen("jj","r")) == NULL) { printf("tough luck \n\n"); exit(0); } while((c = getc(fp)) != EOF) { if((c > '@' && c < '[') || (c > '`' && c < '{' )){ z = c + 13; if(z > 'Z' && z < 'h'){ z -= 90; z += 64; } if(c > 'm'){ c += 13; c -= 122; c += 96; z = c; } putchar(z); } else putchar(c); } printf("\n\n\nDONE\n\n\n"); }