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.
12 SM_RCSID("@(#)$Id: strrevcmp.c,v 1.5 2001/09/11 04:04:49 gshapiro Exp $")
14 #include <sm/config.h>
15 #include <sm/string.h>
19 extern const unsigned char charmap
[];
22 ** SM_STRREVCASECMP -- compare two strings starting at the end (ignore case)
25 ** s1 -- first string.
26 ** s2 -- second string.
29 ** strcasecmp(reverse(s1), reverse(s2))
33 sm_strrevcasecmp(s1
, s2
)
40 while (i1
>= 0 && i2
>= 0 &&
41 charmap
[(unsigned char) s1
[i1
]] ==
42 charmap
[(unsigned char) s2
[i2
]])
59 return (charmap
[(unsigned char) s1
[i1
]] -
60 charmap
[(unsigned char) s2
[i2
]]);
64 ** SM_STRREVCMP -- compare two strings starting at the end
67 ** s1 -- first string.
68 ** s2 -- second string.
71 ** strcmp(reverse(s1), reverse(s2))
82 while (i1
>= 0 && i2
>= 0 && s1
[i1
] == s2
[i2
])
99 return s1
[i1
] - s2
[i2
];