use the standard AROS cause
[AROS.git] / rom / utility / strnicmp.c
blob6a9a7c2801a76c6c89afb11c12ca384fd336fbb2
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <exec/types.h>
9 #include <aros/libcall.h>
10 #include "intern.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/utility.h>
17 AROS_LH3(LONG, Strnicmp,
19 /* SYNOPSIS */
20 AROS_LHA(CONST_STRPTR, string1, A0),
21 AROS_LHA(CONST_STRPTR, string2, A1),
22 AROS_LHA(LONG, length, D0),
24 /* LOCATION */
25 struct UtilityBase *, UtilityBase, 28, Utility)
27 /* FUNCTION
28 Compares two strings treating lower and upper case characters
29 as identical up to a given maximum number of characters.
31 INPUTS
32 string1, string2 - The strings to compare.
33 length - maximum number of characters to compare.
35 RESULT
36 <0 if string1 < string2
37 ==0 if string1 == string2
38 >0 if string1 > string2
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
48 INTERNALS
50 HISTORY
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
55 UBYTE c1, c2;
57 /* 0 characters are always identical */
58 if(!length)
59 return 0;
61 /* Loop as long as the strings are identical and valid. */
64 /* Get characters, convert them to lower case. */
65 c1=ToLower (*string1++);
66 c2=ToLower (*string2++);
67 }while(c1==c2&&c1&&--length);
69 /* Get result. */
70 return (LONG)c1-(LONG)c2;
71 AROS_LIBFUNC_EXIT
72 } /* Strnicmp */