Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

String comaprison

163 views
Skip to first unread message

samir singh

unread,
Jun 2, 2000, 3:00:00 AM6/2/00
to
Hi,

I am new to VxWorks and would like to know if there is any function for
string comparison without case or I have to write one.

Thanks in advance
Samir

Joe Durusau

unread,
Jun 2, 2000, 3:00:00 AM6/2/00
to
The standard C functions, strcmp and strncmp are available
in most versions of vxWorks.

Speaking only for myself,

Joe Durusau

samir singh

unread,
Jun 2, 2000, 3:00:00 AM6/2/00
to
Yes, we have that but would like to have something which ignore case
while comparison like strcasecmp. Do you have any idea?

thanks
samir

Bruce

unread,
Jun 2, 2000, 3:00:00 AM6/2/00
to
In comp.os.vxworks
samir singh <sam...@nortelnetworks.com> wrote:

>Yes, we have that but would like to have something which ignore case
>while comparison like strcasecmp. Do you have any idea?
>
>thanks
>samir
>
>Joe Durusau wrote:
>>
>> The standard C functions, strcmp and strncmp are available
>> in most versions of vxWorks.

HEELLLLOOOO! strncmp() What do you think it does? It isn't ANSI standard
though.


Randy Lexvold

unread,
Jun 3, 2000, 3:00:00 AM6/3/00
to
Bruce,
HEELLLLOOOO yourself. Maybe you should read the reference manual before
being so rude. strncmp() compares n bytes of a string and is case
sensitive. He is looking for something like stricmp() which is case
insensitve, but does not exist in VxWorks.

Samir,
I haven't found a case insenstive strcmp function in VxWorks.

Randy

Bruce <snap...@southwesternbell.net> wrote in message
news:39384385...@news.swbell.net...

David D Golombek

unread,
Jun 3, 2000, 3:00:00 AM6/3/00
to
strcasecmp isn't included in vxworks, but you can write your own
trivially. I think this is correct, haven't really tested it. Look
in the linux or *bsd sources (or P.J Plaugher's C library book) for
proven implementations.

int
strcasecmp(const char *s1, const char *s2) {
const char *t1 = (const char *)s1;
const char *t2 = (const char *)s2;

while (tolower(*t1) == tolower(*t2++))
if (*t1++ == '\0')
return (0);
return (tolower(*t1) - tolower(*--t2));
}


DaveG o_, o, o_ o_ o'
Programmer )-' /|' ),` ) ' (\ ^o Gymnast
Dancer >\ / > >\ >^' >\ >>' Hiker
da...@maker.com www.maker.com (508)621-0658
da...@mit.edu www.mit.edu/~daveg/ (617)216-4705

0 new messages