Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site fortune.UUCP
Path: utzoo!linus!wivax!decvax!harpo!seismo!hao!hplabs!hpda!fortune!berry
From: berry@fortune.UUCP
Newsgroups: net.games.trivia
Subject: Re: Re: What the He double toothpicks is - (nf)
Message-ID: <1176@fortune.UUCP>
Date: Thu, 23-Jun-83 23:02:35 EDT
Article-I.D.: fortune.1176
Posted: Thu Jun 23 23:02:35 1983
Date-Received: Sat, 25-Jun-83 18:41:09 EDT
Sender: notes@fortune.UUCP
Organization: Fortune Systems, San Carlos, CA
Lines: 72

#R:ihuxi:-45300:fortune:4500005:000:1192
fortune!berry    Jun 23 17:24:00 1983

	Don't feel to bad, I'm sure most/all of the rest of us had
to ask at one time.  When I did I received half a dozen letters on
what and how to undo rot13.  The easiest way is:

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

or you can use the following program:

/*
 * do a rot
 *
 *	rot [shift factor] [files]
 *		shift factor defaults to 13
 *		files		"     "  stdin
 */

#include	
#include	

#define	ROT	13

main(argc, argv)
int	argc;
char	*argv[]; {
	int	rot;
	char	c;

	if((argc < 2) || ((rot = atoi(argv[1])) == 0))
		rot = ROT;
	else {
		argc--;
		++argv;
	}

	while(*++argv) {
		if(freopen(*argv, "r", stdin) == NULL)
			perror(*argv);
		else
			rotate(rot);
	}
	if(argc == 1)
		rotate(rot);
	exit(0);
}

rotate(rot)
int	rot;
{
	char	c;

	while((c=getchar()) != EOF) {
		if(isupper(c))
			c = 'A' + (c - 'A' + rot) % 26;
		else if(islower(c))
			c = 'a' + (c - 'a' + rot) % 26;
		putchar(c);
	}
}

The above was received in one of the letters I received and then heavily
modified by me.  Whoever sent it I appreciate it and apologize for
not having the foresight/courtesy to jot down your name to reference.


	David W. Berry
	hpda!fortune!berry
	harpo!fortune!berry
	ihnp4!fortune!berry