2 * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
11 #pragma ident "%Z%%M% %I% %E% SMI"
14 SM_RCSID("@(#)$Id: strrevcmp.c,v 1.2 2001/08/27 22:21:51 gshapiro Exp $")
16 #include <sm/config.h>
17 #include <sm/string.h>
21 extern const unsigned char charmap
[];
24 ** SM_STRREVCASECMP -- compare two strings starting at the end (ignore case)
27 ** s1 -- first string.
28 ** s2 -- second string.
31 ** strcasecmp(reverse(s1), reverse(s2))
35 sm_strrevcasecmp(s1
, s2
)
42 while (i1
>= 0 && i2
>= 0 &&
43 charmap
[(unsigned char) s1
[i1
]] ==
44 charmap
[(unsigned char) s2
[i2
]])
61 return (charmap
[(unsigned char) s1
[i1
]] -
62 charmap
[(unsigned char) s2
[i2
]]);
66 ** SM_STRREVCMP -- compare two strings starting at the end
69 ** s1 -- first string.
70 ** s2 -- second string.
73 ** strcmp(reverse(s1), reverse(s2))
84 while (i1
>= 0 && i2
>= 0 && s1
[i1
] == s2
[i2
])
101 return s1
[i1
] - s2
[i2
];