Fix for initialization of scalos preferences library. Library is now loaded only...
[AROS-Contrib.git] / rexx / lstring / compare.c
blob9132f10fb7a6f5ec17b9efa13270e16b4f5ced6e
1 /*
2 * $Header$
3 * $Log$
4 * Revision 1.1 2001/04/04 05:43:37 wang
5 * First commit: compiles on Linux, Amiga, Windows, Windows CE, generic gcc
7 * Revision 1.1 1998/07/02 17:17:00 bnv
8 * Initial revision
12 #include <lstring.h>
14 /* ------------------- Lcompare --------------------- *
15 * compares the two strings and returns the position *
16 * of the non matching character [1,largest length] *
17 * returns 0 if strings are equal *
18 * -------------------------------------------------- */
19 long
20 Lcompare( const PLstr A, const PLstr B, const char pad )
22 long i;
23 PLstr a,b;
25 L2STR(A);
26 L2STR(B);
28 if (LLEN(*A) < LLEN(*B)) {
29 a = A;
30 b = B;
31 } else {
32 a = B;
33 b = A;
35 for (i=0; i<LLEN(*a); i++)
36 if (LSTR(*a)[i] != LSTR(*b)[i]) return i+1;
37 for (; i<LLEN(*b); i++)
38 if (pad != LSTR(*b)[i]) return i+1;
40 return 0;
41 } /* Lcompare */