brodie@fps.mcw.edu (12/19/89)
Well, after I asked for it, I got a few copies of a nice rot-13 utility (one in fortran, the other in "C"). However, I don't have any "real" compilers on my system (we're a big MUMPS shop...), so I decided to see if I could do it in DCL. Heh. :-) Well, I've always been under the impression that a creative person can do ANYTHING in DCL, if one tries hard enough. 45 minutes later, I completed the following sketchy utility. It works great. If you do not answer a name for 'Output file', sys$output is assumed. And, as you would expect for a dcl that rips through a text file CHARACTER by CHARACTER, it's PIGGISHLY SLOW. However, since the only real use for this I see is POSTING 8-line joked to rec.humor, that's not a problem. It also could be written more efficiently, but why bother-- it's DCL! Enjoy. Edit article file, @rot13 it, and then post it. Easy. simple. (and slow). $ alphabet = "/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/@/@/@/@/@/@/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/" $ inquire inf "Input file" $ if inf .eqs. "" then $exit $ inquire outf "Output file" $ if outf .eqs. "" then outf = "sys$output" $ open/read inputf 'inf $ open/write outputf 'outf $READIT: $ read/end_of_file=DONE inputf line $ if line .eqs. "" $ then $ write outputf line $ goto READIT $ endif $ linelen = f$length(line) $ len = 0 $ outline = "" $CONVERT: $ len = len + 1 $ letter = f$extract(len-1,1,line) $ newletter = "" $ letterval = f$cvui(0,8,letter) $ if (letterval .ge. 65) .and. (letterval .le. 90) $ then $ if (letterval .gt. 77) $ then $ letterval = letterval - 13 $ else $ letterval = letterval + 13 $ endif $ newletter = f$element(letterval-64,"/",alphabet) $ else $ if (letterval .ge. 97) .and. (letterval .le. 122) $ then $ if (letterval .gt. 109) $ then $ letterval = letterval - 13 $ else $ letterval = letterval + 13 $ endif $ newletter = f$element(letterval-64,"/",alphabet) $ endif $ endif $ if newletter .eqs. "" $ then $ outline = outline + letter $ else $ outline = outline + newletter $ endif $ if (len .eq. linelen) then $goto doneline $ goto CONVERT $DONELINE: $ write outputf outline $ goto READIT $DONE: $ close inputf $ close outputf $ exit god, I must be nuts. (geoff, as a suggestion, add a "POST/ROT13" qualifier. You already have READ/ROT13, so it shouldn't be TOO tough....) [low priority project, of course] ------------------------------------------------------------------------------- Kent C. Brodie - Systems Manager brodie@mcw.edu Medical College of Wisconsin +1 414 778 4500 "Gee, I hope these are the right coordinates..." -Chief O'Brian; STTNG
gih900@UUNET.UU.NET (Geoff Huston) (12/21/89)
>Well, after I asked for it, I got a few copies of a nice rot-13 utility >(one in fortran, the other in "C"). > >However, I don't have any "real" compilers on my system (we're a big >MUMPS shop...), so I decided to see if I could do it in DCL. Heh. :-) > >Well, I've always been under the impression that a creative person can >do ANYTHING in DCL, if one tries hard enough. > >45 minutes later, I completed the following sketchy utility. > >It works great. If you do not answer a name for 'Output file', sys$output >is assumed. I'm impressed!!! >god, I must be nuts. I think the same of myself all too often! >(geoff, as a suggestion, add a "POST/ROT13" qualifier. You already have >READ/ROT13, so it shouldn't be TOO tough....) Wouldn't it be better to have a TPU edit procedure called rot13 to allow you to rot the necessary bits?? (said he trying to avoid having to add the code) Geoff