delorie.com/archives/browse.cgi | search |
From: | "Damian Yerrick" <snews AT pineight DOT 8m DOT comMUNIST-PIGS-AOL> |
Newsgroups: | comp.os.msdos.djgpp |
References: | <Pine DOT LNX DOT 4 DOT 10 DOT 10001080042130 DOT 8004-100000 AT server DOT minilinux DOT org> <Kwwd4.995$tn3 DOT 22412 AT dfiatx1-snr1 DOT gtei DOT net> |
Subject: | Pitiful attempt to bring this thread back on topic |
Lines: | 94 |
Organization: | Pin Eight Software <http://pineight.8m.com/> |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2919.6600 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2919.6600 |
Message-ID: | <7qxd4.1042$tn3.23994@dfiatx1-snr1.gtei.net> |
X-Trace: | 9/74FF/dW3I6fj1pFH6IAg8jz32dGHUuGNHflIZ0q1rYxUHeDdOhOcwdLMqWujhkNx99Y06pf6uX!YJ+yVwB0dmtWhR0FrH1OV6eP6uTd3ZAqRFVISChfdT76UNlcHzwgNT/ndgYIYMpSx+6Mu1hLGg== |
X-Complaints-To: | abuse AT gte DOT net |
X-Abuse-Info: | Please be sure to forward a copy of ALL headers |
X-Abuse-Info: | Otherwise we will be unable to process your complaint properly |
NNTP-Posting-Date: | Sat, 08 Jan 2000 02:37:55 GMT |
Distribution: | world |
Date: | Sat, 08 Jan 2000 02:37:56 GMT |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Today, my two newsgroups collide. I just wrote: > "Wilmer van der Gaast" <lintux AT dds DOT nl> wrote: > > I understand the first part, of course, it's funny, although I > > don't know what's really bad about AOL. http://www.anti-aol.org/ > > But what does the second > > part mean??? Does it mean anything at all?? > > Maybe I'll try coding up a multi-rot program. Good way > to kill an hour. I just did. It handles forward and backward rotation in the ASCII alphabet (upper and lower case). Anyone see any glaring "issues" in this program? I've already tried it with my tiny test suite (hal <--> ibm, two passes of rot13 on several files). [[[ cut here --------------------- cut here ]]] /* ROT.C by Damian Yerrick Rotates the ASCII letters in foo.txt forward by n letters. Copyright (C) 2000 Damian Yerrick This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You can find a copy of the GNU General Public License at http://www.gnu.org/copyleft/gpl.html You can reach Damian Yerrick at d_yerrick AT hotmail DOT com Visit his web site at http://come.to/yerrick Use examples: rot 13 < foo.txt echo HAL | rot 1 echo hello world | rot 13 | rot 13 */ #include <stdio.h> #include <stdlib.h> int chrrotate(int letter, int rot) { if(letter >= 'A' && letter <= 'Z') { letter += rot; if(letter > 'Z') letter -= 26; } else if(letter >= 'a' && letter <= 'z') { letter += rot; if(letter > 'z') letter -= 26; } return letter; } int main(int argc, char **argv) { int rotn = 13; if(argc >= 2) rotn = atoi(argv[1]); /* get rotn above 0 but under 26 */ rotn = (rotn + 26 * (rotn / 26 + 1)) % 26; /* printf("rot%d\n", rotn); */ while(!feof(stdin)) putchar(chrrotate(getchar(), rotn)); return 0; }
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |