Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site aecom.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!ihnp4!zehntel!hplabs!sdcrdcf!sdcsvax!dcdwest!ittvax!decvax!mcnc!philabs!aecom!poppers
From: poppers@aecom.UUCP
Newsgroups: net.jokes.d
Subject: Re: Rotation of files
Message-ID: <700@aecom.UUCP>
Date: Mon, 4-Jun-84 18:39:40 EDT
Article-I.D.: aecom.700
Posted: Mon Jun  4 18:39:40 1984
Date-Received: Wed, 13-Jun-84 00:04:33 EDT
Organization: Albert Einstein Coll. of Med., NY
Lines: 64

Since I keep seeing requests from people for the source to a program
to "rot" something, let me repost one such program which found its
way onto the net a few months ago.


/*
 * 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;

	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;
{
	register char c; /* you may want to declare this "int" */
	int sub=0;

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

/* Off the Wall of Gene Spafford
School of ICS, Georgia Tech, Atlanta GA 30332
CSNet:	Spaf @ GATech		ARPA:	Spaf.GATech @ CSNet-Relay
uucp:   philabs!allegra!gatech!spaf */

     This program has been reposted by the "peritus clavis AECOMae machinae."
Have a good summer, everybody!