Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool2.mu.edu!sdd.hp.com!uakari.primate.wisc.edu!pikes!cudnvr!pwyles From: pwyles@cudnvr.denver.colorado.edu Newsgroups: comp.lang.c Subject: Re: Help! Can you figure out this program? Mostly jus Message-ID: <1991Jan21.133001.19@cudnvr.denver.colorado.edu> Date: 21 Jan 91 13:23:00 GMT References: <7$T+NM%@irie.ais.org> Followup-To: comp.lang.c Lines: 27 In article <7$T+NM%@irie.ais.org>, jph@ais.org (Joseph Hillenburg) writes: > > This is a program originally written for VMS, which converts text into > rot13, and used to work. However, I ported it to UNIX, and it still > worked, but when I added the routine to figure out what name you ran it by, > it died. I know this is real simple, but I can't figure it out. I'd > appreciate mail, and a comment telling me *what* has been changed, so I don't > have to ask next time. :) > > [90 lines of C code deleted] Here is my dolution for rot13. Why would it matter what name you ran it by? usage: rot13 output_file #include main(){int c;for(;(c=getchar())!=EOF;c>='a'&&c<='m'||c>='A'&&c<='M' ?putchar(c+13):c>='n'&&c<='z'||c>='N'&&c<='Z'?putchar(c-13):putchar(c));} /* carrige return in second line is to make the mailer happy */ --paul Paul Wyles ------------------------------------------------------------------------------- CU-Denver Computing Services, Campus Box 169 / boulder!pikes!pwyles 1200 Larimer, NC2506, Denver CO 80204 / pwyles@cudenver.bitnet P.O. Box 173364, Denver CO 80217-3364 / pwyles@pikes.denver.colorado.edu