amos@taux01.nsc.com (Amos Shapir) (10/29/90)
The 'h' command doesn't work as distributed. To fix, precede each call to 'toupper' in hexsrch.c by an appropriate 'if(islower(a))' test. (I wonder why people bother to post programs they never checked themselves even once - there's no way this could have worked on any UNIX version I know) Also, if you have a BSD-ish system, you'd have to change 'strchr' to 'index', and write your own 'memcmp' (maybe 'strcmp' would work too). -- Amos Shapir amos@taux01.nsc.com, amos@nsc.nsc.com National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel Tel. +972 52 522255 TWX: 33691, fax: +972-52-558322 GEO: 34 48 E / 32 10 N
clh@seer.UUCP (Chris Hatch) (10/30/90)
In article <4902@taux01.nsc.com> amos@taux01.nsc.com (Amos Shapir) writes: >The 'h' command doesn't work as distributed. To fix, precede each call to >'toupper' in hexsrch.c by an appropriate 'if(islower(a))' test. >(I wonder why people bother to post programs they never checked themselves >even once - there's no way this could have worked on any UNIX version I know) Actually, by definition 'if (islower(a)) a=toupper(a);' should be the exact same thing as 'a=toupper(a);'. If that is not the case, then your compiler (or rather your library) is broken. This is in ANSI... Don't know about the Unix "standards."
amos@taux01.nsc.com (Amos Shapir) (11/03/90)
[Quoted from the referenced article by clh@seer.UUCP (Chris Hatch)] > >Actually, by definition 'if (islower(a)) a=toupper(a);' should be the exact >same thing as 'a=toupper(a);'. If that is not the case, then your compiler >(or rather your library) is broken. This is in ANSI... Don't know about >the Unix "standards." But this is how toupper/tolower were originally defined, and how they are still defined on major versions of UNIX; I'd expect someone who posts a supposedly portable program to take care of that. It would have been ok if he stated "this only works on Sys V", but previous versions of bpe were more portable, and its Makefile contains a lot of -D's for configuration. (Also note that unlike this new addition, the older file bpe.c does have an appropriate islower test before toupper). -- Amos Shapir amos@taux01.nsc.com, amos@nsc.nsc.com National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel Tel. +972 52 522255 TWX: 33691, fax: +972-52-558322 GEO: 34 48 E / 32 10 N
prc@erbe.se (Robert Claeson) (11/04/90)
In a recent article clh@seer.UUCP (Chris Hatch) writes: >Actually, by definition 'if (islower(a)) a=toupper(a);' should be the exact >same thing as 'a=toupper(a);'. If that is not the case, then your compiler >(or rather your library) is broken. This is in ANSI... Don't know about >the Unix "standards." System V does the same thing as ANSI C. BSD and other derivaties doesn't. -- Robert Claeson |Reasonable mailers: rclaeson@erbe.se ERBE DATA AB | Dumb mailers: rclaeson%erbe.se@sunet.se | Perverse mailers: rclaeson%erbe.se@encore.com These opinions reflect my personal views and not those of my employer.
kris@beep.UUCP (Port'naybl) (11/06/90)
In article <668@seer.UUCP>, clh@seer.UUCP (Chris Hatch) writes: >In article <4902@taux01.nsc.com> amos@taux01.nsc.com (Amos Shapir) writes: >>The 'h' command doesn't work as distributed. To fix, precede each call to >>'toupper' in hexsrch.c by an appropriate 'if(islower(a))' test. >>(I wonder why people bother to post programs they never checked themselves >>even once - there's no way this could have worked on any UNIX version I know) On my System V.2 (beep), toupper (a) returns a unmodified if a is not a lower-case character. This seems right and proper to me. >Actually, by definition 'if (islower(a)) a=toupper(a);' should be the exact >same thing as 'a=toupper(a);'. If that is not the case, then your compiler >(or rather your library) is broken. This is in ANSI... Don't know about >the Unix "standards." One system (I will not name it) I worked on returned (a - 0x20) from toupper (a) and the corresponding tolower (a) returned (a + 0x20) for ALL valued of a. Took me a while to figure out that it WASN'T my program. I finally wrote a quick-and-dirty utility that displayed how the <ctype.h> functions handled the various byte values that could be fed to them. This is how I discovered that toupper() and tolower() didn't act like I expected them. Now I keep a copy of this utility on each system I use. -- Port'naybl key!beep!kris woodowl!beep!kris "Look what they've done to my program, look what they've done to my code; They stuck it all on this floppy disk, and I think they got it wrong, ma..."
kirkaas@oahu.cs.ucla.edu (paul kirkaas) (11/08/90)
In article <98@beep.UUCP> kris@beep.UUCP (Port'naybl) writes: > One system (I will not name it) I worked on returned (a - 0x20) from >toupper (a) and the corresponding tolower (a) returned (a + 0x20) for ALL >valued of a. Took me a while to figure out that it WASN'T my program. I I have never understood this misguided sense of "ethics" on the net to avoid mentioning names of companies who have done something a particular way. If you are worried about slander, you needn't be, as long as the company really did what you say it did. -- -- Paul Kirkaas kirkaas@cs.ucla.edu