bug in vn 04/88 rot13

Mike Khaw mkhaw at teknowledge-vaxc.ARPA
Wed Oct 5 07:01:57 AEST 1988


The algorithm used by the vn newsreader to (un)rot13 doesn't work
correctly for every character.  Specifically, I find that "k" and
"m" get mapped to non-printing characters.

I replaced vn's algorithm with the one used by rn.  The fix is really
too short for a patch.  Just replace the rot_line() function in reader.c
with the following version:

<--- cut here --->
static
rot_line (s)
unsigned char *s;
{
	/* short circuit if no rot */
	if (Rot == 0)
		return;

	for ( ; *s != '\0'; ++s)
	{
		/* adapted from rn's rot algorithm */
		*s += isalpha(*s) ? ((*s & 31) <= 13) ? Rot : -Rot : 0;
	}
}
<--- cut here --->

Mike Khaw
-- 
internet: mkhaw at teknowledge.arpa
uucp:	  {uunet|sun|ucbvax|decwrl|uw-beaver}!mkhaw%teknowledge.arpa
hardcopy: Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303



More information about the Comp.sources.bugs mailing list