home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * STRING.C
- *
- * $Header: Beta:src/uucp/src/lib/RCS/string.c,v 1.1 90/02/02 12:08:41 dillon Exp Locker: dillon $
- *
- * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved.
- */
-
- #include <stdio.h>
- #include "config.h"
-
- Prototype int strcmpi(const char *, const char *);
- Prototype int strncmpi(const char *, const char *, int);
-
- int
- strcmpi(s, d)
- const char *s;
- const char *d;
- {
- short c1, c2;
- for (;;) {
- c1 = *s++;
- c2 = *d++;
-
- if (c1 == 0 || c2 == 0)
- return(c1 || c2); /* 0= both are 0 */
- if (((c1 ^ c2) | 0x20) != 0x20)
- return(1);
- }
- return(0);
- }
-
- int
- strncmpi(s, d, n)
- const char *s;
- const char *d;
- int n;
- {
- short c1, c2;
- while (n--) {
- c1 = *s++;
- c2 = *d++;
-
- if (c1 == 0 || c2 == 0)
- return(c1 || c2); /* 0= both are 0 */
- if (((c1 ^ c2) | 0x20) != 0x20)
- return(1);
- }
- return(0);
- }
-
-