version 1.3, 1998/12/08 22:03:06
|
version 1.6, 2003/01/26 20:56:38
|
Line 16
|
Line 16
|
|
|
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software |
along with this program; if not, write to the Free Software |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. |
*/ |
*/ |
|
|
/* this is mainly useful for testing for equality; to get a version |
/* this is mainly useful for testing for equality; to get a version |
that delivers the right < and > results in any locale, you would |
that delivers the right < and > results in any locale, you would |
have to work with strcoll and some hackery */ |
have to work with strcoll and some hackery */ |
|
|
#include <ctype.h> |
|
#include "forth.h" |
#include "forth.h" |
|
#include <ctype.h> |
|
|
Cell memcasecmp(const Char *s1, const Char *s2, Cell n) |
Cell memcasecmp(const Char *s1, const Char *s2, Cell n) |
{ |
{ |
Line 33 Cell memcasecmp(const Char *s1, const Ch
|
Line 33 Cell memcasecmp(const Char *s1, const Ch
|
for (i=0; i<n; i++) { |
for (i=0; i<n; i++) { |
Char c1=toupper(s1[i]); |
Char c1=toupper(s1[i]); |
Char c2=toupper(s2[i]); |
Char c2=toupper(s2[i]); |
if (c1 != c2) |
if (c1 != c2) { |
return c1-c2; |
if (c1 < c2) |
|
return -1; |
|
else |
|
return 1; |
|
} |
} |
} |
return 0; |
return 0; |
} |
} |