Return to BSD News archive
Xref: sserve comp.os.386bsd.bugs:1809 comp.bugs.4bsd:2004 Newsgroups: comp.os.386bsd.bugs,comp.bugs.4bsd Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!usc!math.ohio-state.edu!cyber2.cyberstore.ca!nntp.cs.ubc.ca!utcsri!utnut!torn!nott!uotcsi2!revcan!micor!latour!diana!db From: db@diana.ocunix.on.ca (Dyane Bruce) Subject: /usr/games/bcd bug update Message-ID: <1993Nov11.085209.12522@diana.ocunix.on.ca> Organization: db Software Date: Thu, 11 Nov 1993 08:52:09 GMT Lines: 111 A week ago I posted a patch for bcd.c, I realized I goofed with the patch file (I reversed the patch), and in checking it over I found two other errors in the table. The other two errors in the table are masked by the fact that the input is converted to upper case before conversion. I read the comment in the source about converting the input to upper case before lookup and then thought it was only a 128 byte lookup table. (Even though it quite clearly says it is 256 bytes :-( ). I then assumed he was only filling in all the entries for "correctness" i.e. upper and lower case. I thought I correcting the lower case bit map entry, when I was actually correcting the "high bit" set upper case. I didn't bother reposting this correction (Repeat after me: "It is only a whimsy program") but did send a version of the updated patch into netbsd-bugs as I found it in netbsd 0.9 However, the bug was also in my stock SUN 3/60 4.1 binaries! so I'm sure it's still in other BSDish systems. As someone actually asked me about this bug via email, I thought I'd better post this correction. BTW, I'd still like to know if the bug was in the original V7 version of this "whimsy" program... If anybody can tell me, I'd love to know. Steve claims in the comments he used the original V7 binary and a shell script to determine the BCD table to use in his version. He also states that the output of his version of bcd matched the original V7 version exactly. Now I'm really curious if the original V7 version did indeed have the table wrong. ;-) Oh, BTW I also fixed my SUNOS buggy bcd. :-) *** bcd.c.org Fri Nov 5 09:09:55 1993 --- bcd.c Fri Nov 5 09:30:08 1993 *************** *** 60,65 **** --- 60,80 ---- * Steve Hayman * sahayman@iuvax.cs.indiana.edu * 1989 11 30 + * + * I found an error in the table. The same error is found in + * the SUNOS 4.1.1 version of bcd. It has apparently been around + * a long time. The error caused 'Q' and 'R' to have the same + * punch code. I only noticed the error due to someone pointing + * it out to me when the program was used to print a cover for + * an APA! + * + * The table was wrong in 4 places. The other error was masked + * by the fact that the input is converted to upper case before + * lookup. + * + * Dyane Bruce + * db@diana.ocunix.on.ca + * Nov 5, 1993 */ #include <sys/types.h> *************** *** 77,87 **** 0x002, 0x001, 0x012, 0x40a, 0x80a, 0x212, 0x00a, 0x006, 0x022, 0x900, 0x880, 0x840, 0x820, 0x810, 0x808, 0x804, 0x802, 0x801, 0x500, 0x480, 0x440, 0x420, 0x410, 0x408, ! 0x404, 0x402, 0x402, 0x280, 0x240, 0x220, 0x210, 0x208, 0x204, 0x202, 0x201, 0x082, 0x822, 0x600, 0x282, 0x30f, 0x900, 0x880, 0x840, 0x820, 0x810, 0x808, 0x804, 0x802, 0x801, 0x500, 0x480, 0x440, 0x420, 0x410, 0x408, 0x404, ! 0x402, 0x402, 0x280, 0x240, 0x220, 0x210, 0x208, 0x204, 0x202, 0x201, 0x082, 0x806, 0x822, 0x600, 0x282, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, --- 92,102 ---- 0x002, 0x001, 0x012, 0x40a, 0x80a, 0x212, 0x00a, 0x006, 0x022, 0x900, 0x880, 0x840, 0x820, 0x810, 0x808, 0x804, 0x802, 0x801, 0x500, 0x480, 0x440, 0x420, 0x410, 0x408, ! 0x404, 0x402, 0x401, 0x280, 0x240, 0x220, 0x210, 0x208, 0x204, 0x202, 0x201, 0x082, 0x822, 0x600, 0x282, 0x30f, 0x900, 0x880, 0x840, 0x820, 0x810, 0x808, 0x804, 0x802, 0x801, 0x500, 0x480, 0x440, 0x420, 0x410, 0x408, 0x404, ! 0x402, 0x401, 0x280, 0x240, 0x220, 0x210, 0x208, 0x204, 0x202, 0x201, 0x082, 0x806, 0x822, 0x600, 0x282, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, *************** *** 93,103 **** 0x001, 0x012, 0x40a, 0x80a, 0x212, 0x00a, 0x006, 0x022, 0x900, 0x880, 0x840, 0x820, 0x810, 0x808, 0x804, 0x802, 0x801, 0x500, 0x480, 0x440, 0x420, 0x410, 0x408, 0x404, ! 0x402, 0x402, 0x280, 0x240, 0x220, 0x210, 0x208, 0x204, 0x202, 0x201, 0x082, 0x806, 0x822, 0x600, 0x282, 0x30f, 0x900, 0x880, 0x840, 0x820, 0x810, 0x808, 0x804, 0x802, 0x801, 0x500, 0x480, 0x440, 0x420, 0x410, 0x408, 0x404, ! 0x402, 0x402, 0x280, 0x240, 0x220, 0x210, 0x208, 0x204, 0x202, 0x201, 0x082, 0x806, 0x822, 0x600, 0x282, 0x0 }; --- 108,118 ---- 0x001, 0x012, 0x40a, 0x80a, 0x212, 0x00a, 0x006, 0x022, 0x900, 0x880, 0x840, 0x820, 0x810, 0x808, 0x804, 0x802, 0x801, 0x500, 0x480, 0x440, 0x420, 0x410, 0x408, 0x404, ! 0x402, 0x401, 0x280, 0x240, 0x220, 0x210, 0x208, 0x204, 0x202, 0x201, 0x082, 0x806, 0x822, 0x600, 0x282, 0x30f, 0x900, 0x880, 0x840, 0x820, 0x810, 0x808, 0x804, 0x802, 0x801, 0x500, 0x480, 0x440, 0x420, 0x410, 0x408, 0x404, ! 0x402, 0x401, 0x280, 0x240, 0x220, 0x210, 0x208, 0x204, 0x202, 0x201, 0x082, 0x806, 0x822, 0x600, 0x282, 0x0 }; -- Dyane Bruce db@diana.ocunix.on.ca 29 Vanson Ave. Nepean On, K2E 6A9 Am I the only one who has trouble 613-225-9920 thinking up witty sayings for here?