[comp.lang.c] Help! Can you figure out this program? Mostly jus

pwyles@cudnvr.denver.colorado.edu (01/21/91)

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

cs163wcr@sdcc10.ucsd.edu (C Code. C Code run.) (01/29/91)

In article <1991Jan21.133001.19@cudnvr.denver.colorado.edu> pwyles@cudnvr.denver.colorado.edu writes:
> [Rot 13 problems deleted]

If you're on Unix, why not use "tr A-Za-z N-ZA-Mn-za-m" as an
alias for rot13?  I do...

Steve Boswell
whatis@ucsd.edu