*BSD News Article 38050


Return to BSD News archive

Xref: sserve comp.sys.sun.misc:16337 comp.unix.bsd:15321
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!spool.mu.edu!sgiblab!uhog.mit.edu!news.mathworks.com!mvb.saic.com!eskimo!rwing!pat
From: pat@rwing.UUCP (Pat Myrto)
Newsgroups: comp.sys.sun.misc,comp.unix.bsd
Subject: Re: Undocumented SunOS libc function stricmp
Message-ID: <3741@rwing.UUCP>
Date: 18 Nov 94 17:39:07 GMT
References: <3a81be$4rq@zebedee.ingres.co.uk>
Organization: Totally Unorganized
Lines: 38

In article <3a81be$4rq@zebedee.ingres.co.uk> you write:
>I have some code from a customer which worked on SunOS but wont build on Solaris
> due to undefined symbol stricmp.  stricmp exists in the SunOS libc.a but I can'
>t find any documentation on it.  The consultant who wrote the code has long sinc
>e gone so I have no idea what the function should do or what the Solaris equival
>ent may be.  Does anyone have any info on this function.

Its just a renamed version of strcasecmp(), and strnicmp is strncasecmp().
It appears to be just a wrapper that calls strcasecmp(), passing the
args argument for argument on to strcasecmp().  So you can  use the
manpage for strcasecmp(3) for usage info, and treat it the same (its a
string compare that ignores case).  In fact, if you replace the calls
to stricmp() with strcasecmp(), you eliminate one level of function
call, and the overhead.  I have seen other flavers like strcmpi() and
strncmpi(), as well.

I have no idea why it was put in there, other than to perhaps provide
compatability to code built using some other libraries - I remember the
call or something like it in Microsoft C for MSDOS, and the lack of that
function in Unix, but the presence of strcasecmp() in BSD derived
libraries, but I don't know if the function is an early ANSI, pre-ansi
function or what.  I became aware when I find a case-ignore string
compare SysVr3 libs, and I hacked up a version of it, till I discoverd
strcasecmp() in lib source for BSD on uunet, and realized it was the
same thing.

>
>Duncan Mackinder
>CA-INGRES UK Technical Support
>
>#include <standard disclaimer>


-- 
pat@rwing  [If all fails, try:  rwing!pat@eskimo.com]  Pat Myrto - Seattle WA
"No one has the right to destroy another person's belief by demanding
empirical evidence."  --   Ann Landers, nationally syndicated advice columnist
and Director at Handgun Control Inc.