Commit | Line | Data |
---|---|---|
5f522de8 C |
1 | /* lexnequ.c - Compare two strings ignoring case upto n octets */ |
2 | ||
3 | #ifndef lint | |
4 | static char *rcsid = "$Header: /f/osi/compat/RCS/lexnequ.c,v 7.1 91/02/22 09:15:26 mrose Interim $"; | |
5 | #endif | |
6 | ||
7 | /* | |
8 | * $Header: /f/osi/compat/RCS/lexnequ.c,v 7.1 91/02/22 09:15:26 mrose Interim $ | |
9 | * | |
10 | * | |
11 | * $Log: lexnequ.c,v $ | |
12 | * Revision 7.1 91/02/22 09:15:26 mrose | |
13 | * Interim 6.8 | |
14 | * | |
15 | * Revision 7.0 89/11/23 21:23:13 mrose | |
16 | * Release 6.0 | |
17 | * | |
18 | */ | |
19 | ||
20 | /* | |
21 | * NOTICE | |
22 | * | |
23 | * Acquisition, use, and distribution of this module and related | |
24 | * materials are subject to the restrictions of a license agreement. | |
25 | * Consult the Preface in the User's Manual for the full terms of | |
26 | * this agreement. | |
27 | * | |
28 | */ | |
29 | ||
30 | ||
31 | /* LINTLIBRARY */ | |
32 | ||
33 | #include <stdio.h> | |
34 | #include "general.h" | |
35 | ||
36 | /* \f */ | |
37 | ||
38 | lexnequ (str1, str2, len) | |
39 | register char *str1, | |
40 | *str2; | |
41 | int len; | |
42 | { | |
43 | register int count = 1; | |
44 | ||
45 | if (str1 == NULL) | |
46 | if (str2 == NULL) | |
47 | return (0); | |
48 | else | |
49 | return (1); | |
50 | ||
51 | if (str2 == NULL) | |
52 | return (-1); | |
53 | ||
54 | while (chrcnv[*str1] == chrcnv[*str2++]) { | |
55 | if (count++ >= len) | |
56 | return (0); | |
57 | if (*str1++ == NULL) | |
58 | return (0); | |
59 | } | |
60 | ||
61 | str2--; | |
62 | if (chrcnv[*str1] > chrcnv[*str2]) | |
63 | return (1); | |
64 | else | |
65 | return (-1); | |
66 | } |