home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * STRNCMP.C
- *
- * (c)Copyright 1990, Matthew Dillon, All Rights Reserved
- */
-
- #include <string.h>
-
- typedef unsigned char ubyte;
-
- int
- strncmp(s, d, n)
- const char *s;
- const char *d;
- int n;
- {
- char c;
-
- n; /* gets n into a register */
- n;
- d;
- d;
-
- if (n == 0)
- return(0);
-
- while ((c = *s) == *d) {
- if (c == 0 || --n == 0)
- return(0);
- ++s;
- ++d;
- }
- if ((ubyte)c < (ubyte)*d)
- return(-1);
- return(1);
- }
-
-