Help! Can you figure out this program? Mostly jus

pwyles at cudnvr.denver.colorado.edu pwyles at cudnvr.denver.colorado.edu
Tue Jan 22 00:23:00 AEST 1991


In article <7$T+NM%@irie.ais.org>, jph at 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 <input_file >output_file

#include<stdio.h>
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 at cudenver.bitnet
P.O. Box 173364, Denver CO 80217-3364       /  pwyles at pikes.denver.colorado.edu



More information about the Comp.lang.c mailing list