]> git.sur5r.net Git - openldap/blob - libraries/vms/strings.c
Suck in global schema dn and operational attributes changes
[openldap] / libraries / vms / strings.c
1 /*
2  * strings.c
3  */
4 #include <string.h>
5 #include <stdlib.h>
6
7
8 #ifndef NO_GLOBALS
9 /*
10  * Copyright (c) 1987 Regents of the University of California.
11  * All rights reserved.  The Berkeley software License Agreement
12  * specifies the terms and conditions for redistribution.
13  */
14 /*
15  * This array is designed for mapping upper and lower case letter
16  * together for a case independent comparison.  The mappings are
17  * based upon ascii character sequences.
18  */
19 static char charmap[] = {
20         '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
21         '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
22         '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
23         '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
24         '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
25         '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
26         '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
27         '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
28         '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
29         '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
30         '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
31         '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
32         '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
33         '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
34         '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
35         '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
36         '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
37         '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
38         '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
39         '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
40         '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
41         '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
42         '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
43         '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
44         '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
45         '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
46         '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
47         '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337',
48         '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
49         '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
50         '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
51         '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
52 };
53
54 int
55 strcasecmp(s1, s2)
56         register char *s1, *s2;
57 {
58         register char *cm = charmap;
59
60         while (cm[*s1] == cm[*s2++])
61                 if (*s1++ == '\0')
62                         return(0);
63         return(cm[*s1] - cm[*--s2]);
64 }
65
66 int
67 strncasecmp(s1, s2, n)
68         register char *s1, *s2;
69         register long n;
70 {
71         register char *cm = charmap;
72
73         while (--n >= 0 && cm[*s1] == cm[*s2++])
74                 if (*s1++ == '\0')
75                         return(0);
76         return(n < 0 ? 0 : cm[*s1] - cm[*--s2]);
77 }
78 #endif NO_GLOBALS
79
80
81 char *
82 strdup( p )
83         char    *p;
84 {
85         char    *r;
86
87         r = (char *) malloc( strlen( p ) + 1 );
88         if ( r != NULL ) {
89                 strcpy( r, p );
90         }
91
92         return( r );
93 }
94
95 void bcopy (void * src, void *dest, int n) {
96         memmove(dest, src, n);
97 }