I used the following code fragment as the comparison
routine passed to qsort() (STDC lib). I interchanged
strcmp(), Stricmp(), and Strnicmp(). I opened the
utility.library, OpenLibrary( "utility.library", 37 ),
prior to calling qsort(). The below three columns
show the output of their respective sorts.
I am using Aztec C 5.2a on a 2000HD with DOS 2.04.
Does anyone know what is going on?
qsort_comparison( void * s1, void * s2 )
{
return (int) Stricmp( *(char**)s1, *(char**)s2 );
}
strcmp(s1,s2) Stricmp(s1,s2) Strnicmp(s1,s2,100)
============== ============== ==============
README sh.dbg amigaregex.c
amigaregex.c sh2 sh
amigaregex.doc sh1 test.out
amigaregex.o test.out makefile
makefile sh amigaregex.o
sh amigaregex.doc amigaregex.doc
sh.dbg README README
sh1 makefile sh1
sh2 amigaregex.o sh2
test.out amigaregex.c sh.dbg
____________________________________________
John R Veregge - jo...@pluto.jpl.nasa.gov
Not that I know of...
>I am using Aztec C 5.2a on a 2000HD with DOS 2.04.
> qsort_comparison( void * s1, void * s2 )
> {
> return (int) Stricmp( *(char**)s1, *(char**)s2 );
> }
Are you certain that those void *'s are char **'s? Did you try it
with strcmp in the same place? Are you including clib/utility_protos.h?
Are you certain that your qsort wants <0, 0, or >0 for a return, and not
-1, 0, and 1?
--
To be or not to be = 0xff
-
Randell Jesup, Jack-of-quite-a-few-trades, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, je...@cbmvax.cbm.commodore.com BIX: rjesup
Disclaimer: Nothing I say is anything other than my personal opinion.
(Incidental music please... Elmer Fudd laughing will do {-; {-; {-;)
I always use the Aztec 5.2a C glue routines, instead of the pragma's,
when testing because it speeds up the builds. I tested Stricmp() using
the pragma's after I posted the aformentioned message. The pragma's
worked fine. The problem was not in the AmigaDOS routine Stricmp(),
but Aztec's 5.2a glue routine for it. Ummm, err, never mind...
I think I'll go back to the safer world of X11 development. {-; {-; {-;