[net.unix] Saving rotated jokes unrotated

neal@weitek.UUCP (Neal Bedard) (05/22/85)

	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!!!

I'm assuming you know how to use postnews. The steps are:

	1. Save the joke in rotated form from readnews (or equiv.) 
           in a file.

	2. Invoke postnews, by exiting readnews or by posting a followup
	   article.

	3. When prompted for "newsgroups", enter net.jokes. This is
	   crucial, as postnews will send rotated text to this group only.

	4. While in the editor, read the file saved above in (1) into the
	   text to be posted.

	5. Exit the editor. Postnews will ask:

		Can this be offensive to anyone ? [n]:

	Enter `y'.

	The previously rotated text will now be unrotated.

	6. postnews will now ask :

		What now ? [send, edit, list, quit, write]

	Write text into a file. Then quit.

Voila! rotated joke saved in readable form.
Maybe someone knows a better way. I'm listening...


 -Neal B.

"Your karma ran over my dogma"
"And so Jung, too..."
"Kant you do anything?"
"Only a Skinner would be useful now..."

jordan@greipa.UUCP (Jordan K. Hubbard) (05/23/85)

Barf! That whole bit about using postnews seemed somewhat.. long..
Just use the 'caesar' program in /usr/lib/news.. I know it comes
in 2.10.2, probably 2.10.1 also.. caesar < rot'd-text-file > readable

It's what I do anyway..
-- 
			Jordan K. Hubbard
			@ Genstar Rental Electronics.
			Palo Alto, CA.
			{sun, decwrl, dual}!twg!greipa!jordan

			"Ack ack!".

				- William the feline

randy@nlm-vax.ARPA (Rand Huntzinger) (05/23/85)

The program which rotates and unrotates jokes is called caesar, and it is
probably resides in the news library directory (on our system /usr/lib/news).
So, you can save a rotated news article by issuing the following command from
rn:

		| /usr/lib/news/caesar > file-name

The commands to do this under readnews and vnews are very similar.

zben@umd5.UUCP (05/23/85)

This is an easier way:

1. Make yourself a shell script named "rot" with this line in it:

   tr a-zA-Z n-za-mN-ZA-M

2. Don't forget to make it executable with: chmod +x rot

3. In the "rn" program you can give commands like:

   | /u/zben/rot | pr | lpr             (Makes a printed copy)
   | /u/zben/rot >/u/zben/savefile      (Saves it in file)

Many other news reading programs have similar exits for invoking pipes.
On this version I had to give the full path name of the filter.  Please
remember to substitute the name of the directory where your filter lives
for the "/u/zben" above.  The full name of the savefile was given above
because rn changes directories a lot, and I don't trust it.

Now, as an exercise to the reader, and to satisfy the requirements of
this group that postings need include a joke, x out and create the filter
and try to decode the remainder of this posting:

N jbzna vf zneevrq, naq fur unf svir puvyqera.  Ure uhfonaq hasbeghangryl
qvrf lbhat, fb fur erzneevrf naq unf svir zber puvyqera.  Guvf uhfonaq nyfb
qvrf fhqqrayl, fb fur lrg ntnva erzneevrf naq unf svir zber puvyqera. 

Svanyyl fur tvirf hc gur tubfg.  Ng ure shareny n snzvyl zrzore jnf urneq
gb erznex: "Jryy, svanyyl gurl ner gbtrgure!"  Na baybbxre, urnevat guvf
erznex, nfxf: "Qb lbh zrna jvgu ure svefg uhfonaq, ure frpbaq uhfonaq, be
ure guveq uhfonaq?".  Gur snzvyl zrzore ercyvrf:

"Ab, fvyyl, ure yrtf!"
-- 
Ben Cranston  ...{seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben  zben@umd2.ARPA

jpexg@mit-hermes.ARPA (John Purbrick) (05/23/85)

> Voila! rotated joke saved in readable form.
> Maybe someone knows a better way. I'm listening...

Maybe not better, but here's a different method. Rot-13 is simply a procedure
of swapping every letter with the one 13 places forward (or back) in the
alphabet (ie a<-->n, b<-->o, c<-->p etc) so a simple program will do it. I
wrote one (with considerable ignorance, but I've never got around to updating
it) called rotify.c which takes the contents of a file and replaces it with 
the rotified version, up to 10000 chars. With this you can save a rot-13 joke 
or make up your own with a question and an answer which is readable by hitting
D. (Obviously, to do this you only rotify the answer.) 

John Purbrick					jpexg@mit-hermes.ARPA
{...decvax!genrad!  ...allegra!mit-vax!}  mit-eddie!mit-hermes!jpexg


#define MAXBYTES 10000
main(){
	int fnum, numbytes, clox;
	char inbuf[MAXBYTES], fname[20];

	printf("What file to rotify? ");
	scanf("%s", fname);			/* Get the file name */

	fnum = open(fname, 522, 0);		/* Open for reading */
	numbytes = read(fnum, inbuf, MAXBYTES);	/* Transfer to buffer */
	close(fnum);
	fnum = open(fname, 1025, 0);		/* Reopen for writing */

	for (clox = 0; clox < numbytes; clox++) 	/* Rotify!! */
	{	if ((inbuf[clox] > ('a'-1)) && (inbuf[clox] < 'n'))
			inbuf[clox] += 13;
		else if ((inbuf[clox] > 'm') && (inbuf[clox] < ('z'+1)))
			inbuf[clox] -= 13;
		else if ((inbuf[clox] > ('A'-1)) && (inbuf[clox] < 'N'))
			inbuf[clox] += 13;
		else if ((inbuf[clox] > 'M') && (inbuf[clox] < ('Z'+1)))
			inbuf[clox] -= 13;
		else continue;			/* Ignore nonalphabetics */
	}
	write(fnum, inbuf, numbytes);		/* Write the file again */
	close(fnum);				/* And close it */
}

rcj1@ihlpm.UUCP (r j) (05/23/85)

 To save rotated jokes unrotated create an executable file named rot
 with the following command in it:

	tr "[A-Z][a-z]" "[N-Z][A-M][n-z][a-m]" < $1 > $1.unrot

 Now, all you have to is: rot $1 - where $1 is the file containing
 the rotated jokes... The unrotated jokes will be in a file
 called $1.unrot.....

 PS: This is for rot13....


			Ray
			ihlpm!rcj1

lionel@garfield.UUCP (Lionel H. Moser) (05/24/85)

> 
> 	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!!!
> 
> I'm assuming you know how to use postnews. The steps are:

Yes there is any easier way.
I just back up to the header for the joke, and issue the
command: D > filename
  This Decodes the joke, and writes the output to the named file.
Lionel H. Moser
Department of Computer Science
Memorial University of Newfoundland
St. John's, Newfoundland
Canada      A1C 5S7

UUCP: {ihnp4, utcsri, allegra} !garfield!lionel

sean@ukma.UUCP (Sean Casey) (05/25/85)

In article <184@weitek.UUCP> neal@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@ANL-MCS.ARPA	
-  University of Kentucky

maxg@tekig.UUCP (Max Guernsey) (05/25/85)

In article <184@weitek.UUCP> neal@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!!!
>
>I'm assuming you know how to use postnews. The steps are:
>
>	1. Save the joke in rotated form from readnews (or equiv.) 
>           in a file.
>
>	2. Invoke postnews, by exiting readnews or by posting a followup
>	   article.
>
>	3. When prompted for "newsgroups", enter net.jokes. This is
>	   crucial, as postnews will send rotated text to this group only.
>
>	4. While in the editor, read the file saved above in (1) into the
>	   text to be posted.
>
>	5. Exit the editor. Postnews will ask:
>
>		Can this be offensive to anyone ? [n]:
>
>	Enter `y'.
>
>	The previously rotated text will now be unrotated.
>
>	6. postnews will now ask :
>
>		What now ? [send, edit, list, quit, write]
>
>	Write text into a file. Then quit.
>
>Voila! rotated joke saved in readable form.
>Maybe someone knows a better way. I'm listening...
>
>
> -Neal B.
>

How 'bout ^x to rn?

schwartz@aecom.UUCP (Yosef Klavan) (05/29/85)

There is a much simpler way to save an encrypted joke in an
uncrypted form. Upon encountering a ROT-13 joke that you
want to save, 'DEROT' it, and pipe it into a file using 'cat'.

Example: on the UNIX here (sys 3), the way to derot a joke is
	 to use a 'D'. SO:

	 D | cat > filename

	   ^
	pipe sign

An immediate hard copy can be printed with 'D | print'.


Enjoy.

haahr@jendeh.UUCP (Paul Haahr) (06/05/85)

> 	 D | cat > filename
> 
> 	   ^
> 	pipe sign

why not "D > filename" ????  C'mon folks, let's remember that cat
copies its input to its output unmodified.