Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site gatech.UUCP Path: utzoo!linus!security!genrad!decvax!duke!mcnc!idis!floyd!clyde!akgua!gatech!spaf From: spaf@gatech.UUCP Newsgroups: net.sources Subject: Rot N program source Message-ID: <3070@gatech.UUCP> Date: Sun, 1-Jan-84 20:53:33 EST Article-I.D.: gatech.3070 Posted: Sun Jan 1 20:53:33 1984 Date-Received: Tue, 3-Jan-84 00:51:08 EST Expires: Sun, 1-Apr-84 00:00:00 EST Organization: Georgia Tech School of ICS, Atlanta Lines: 62 Since I keep seeing requests from people for the source to a program to "rot 13" something, let me repost one such program which found its way onto the net a few months ago. I'll post this with an expiration date far into the future for, ahem, future reference. /* * 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; 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); } } -- Off the Wall of Gene Spafford School of ICS, Georgia Tech, Atlanta GA 30332 CSNet: Spaf @ GATech ARPA: Spaf.GATech @ CSNet-Relay uucp: ...!{akgua,allegra,rlgvax,sb1,unmvax,ulysses,ut-sally}!gatech!spaf