|
Last change
on this file since 10495 was 1678, checked in by bird, 26 years ago |
|
Some bugsfixes - Yield is disabled.
Added parameters.
Correcte moduleheaders.
Introduced a new base class for virtual lx modules + some elf sketches.
|
|
File size:
1.6 KB
|
| Line | |
|---|
| 1 | /* $Id: stricmp.c,v 1.3 1999-11-10 01:45:37 bird Exp $
|
|---|
| 2 | *
|
|---|
| 3 | * stricmp - Case insensitive string compare.
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright (c) 1999 knut st. osmundsen
|
|---|
| 6 | *
|
|---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 8 | *
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | /*******************************************************************************
|
|---|
| 12 | * Defined Constants *
|
|---|
| 13 | *******************************************************************************/
|
|---|
| 14 | #define upcase(ch) \
|
|---|
| 15 | (ch >= 'a' && ch <= 'z' ? ch - ('a' - 'A') : ch)
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 | /*******************************************************************************
|
|---|
| 19 | * Header Files *
|
|---|
| 20 | *******************************************************************************/
|
|---|
| 21 | #include <string.h>
|
|---|
| 22 | #pragma info(nogen, noext, nouni)
|
|---|
| 23 |
|
|---|
| 24 | /**
|
|---|
| 25 | * stricmp - case insensitive string compare.
|
|---|
| 26 | * Not i subsys library.
|
|---|
| 27 | * @param psz1 String 1
|
|---|
| 28 | * @param psz2 String 2
|
|---|
| 29 | * @return 0 if equal
|
|---|
| 30 | * != 0 if not equal
|
|---|
| 31 | */
|
|---|
| 32 | int stricmp(const char *psz1, const char *psz2)
|
|---|
| 33 | {
|
|---|
| 34 | int iRet;
|
|---|
| 35 |
|
|---|
| 36 | while ((iRet = upcase(*psz1) - upcase(*psz2)) == 0 && *psz1 != '\0')
|
|---|
| 37 | psz1++, psz2++;
|
|---|
| 38 |
|
|---|
| 39 | return iRet;
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 | /**
|
|---|
| 45 | * strnicmp - case insensitive string compare for up to cch chars of the strings.
|
|---|
| 46 | * Not i subsys library.
|
|---|
| 47 | * @param psz1 String 1
|
|---|
| 48 | * @param psz2 String 2
|
|---|
| 49 | * @return 0 if equal
|
|---|
| 50 | * != 0 if not equal
|
|---|
| 51 | */
|
|---|
| 52 | int strnicmp(const char *psz1, const char *psz2, size_t cch)
|
|---|
| 53 | {
|
|---|
| 54 | int iRet;
|
|---|
| 55 |
|
|---|
| 56 | while (cch > 0 && (iRet = upcase(*psz1) - upcase(*psz2)) == 0 && *psz1 != '\0')
|
|---|
| 57 | psz1++, psz2++, cch--;
|
|---|
| 58 |
|
|---|
| 59 | return iRet;
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.