File: strdicasecmp.c

package info (click to toggle)
netatalk 3.1.12~ds-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 14,756 kB
  • sloc: ansic: 104,976; sh: 8,247; xml: 7,394; perl: 1,936; makefile: 1,430; python: 1,342; yacc: 309; lex: 49
file content (554 lines) | stat: -rw-r--r-- 11,313 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <atalk/util.h>

const int	_diacasemap[] = {
	/* map	value	name */
	0	/* 0	NUL*/,
	1	/* 1	SOH*/,
	2	/* 2	STX*/,
	3	/* 3	ETX*/,
	4	/* 4	EOT*/,
	5	/* 5	ENQ*/,
	6	/* 6	ACK*/,
	7	/* 7	BEL*/,
	8	/* 8	BS*/,
	9	/* 9	HT*/,
	10	/* 10	NL*/,
	11	/* 11	VT*/,
	12	/* 12	NP*/,
	13	/* 13	CR*/,
	14	/* 14	SO*/,
	15	/* 15	SI*/,
	16	/* 16	DLE*/,
	17	/* 17	DC1*/,
	18	/* 18	DC2*/,
	19	/* 19	DC3*/,
	20	/* 20	DC4*/,
	21	/* 21	NAK*/,
	22	/* 22	SYN*/,
	23	/* 23	ETB*/,
	24	/* 24	CAN*/,
	25	/* 25	EM*/,
	26	/* 26	SUB*/,
	27	/* 27	ESC*/,
	28	/* 28	FS*/,
	29	/* 29	GS*/,
	30	/* 30	RS*/,
	31	/* 31	US*/,
	32	/* 32	SP*/,
	33	/* 33	 ! */,
	34	/* 34	 " */,
	35	/* 35	 # */,
	36	/* 36	 $ */,
	37	/* 37	 % */,
	38	/* 38	 & */,
	39	/* 39	 ' */,
	40	/* 40	 ( */,
	41	/* 41	 ) */,
	42	/* 42	 * */,
	43	/* 43	 + */,
	44	/* 44	 , */,
	45	/* 45	 - */,
	46	/* 46	 . */,
	47	/* 47	 / */,
	48	/* 48	 0 */,
	49	/* 49	 1 */,
	50	/* 50	 2 */,
	51	/* 51	 3 */,
	52	/* 52	 4 */,
	53	/* 53	 5 */,
	54	/* 54	 6 */,
	55	/* 55	 7 */,
	56	/* 56	 8 */,
	57	/* 57	 9 */,
	58	/* 58	 : */,
	59	/* 59	 ; */,
	60	/* 60	 < */,
	61	/* 61	 = */,
	62	/* 62	 > */,
	63	/* 63	 ? */,
	64	/* 64	 @ */,
	65	/* 65	 A */,
	66	/* 66	 B */,
	67	/* 67	 C */,
	68	/* 68	 D */,
	69	/* 69	 E */,
	70	/* 70	 F */,
	71	/* 71	 G */,
	72	/* 72	 H */,
	73	/* 73	 I */,
	74	/* 74	 J */,
	75	/* 75	 K */,
	76	/* 76	 L */,
	77	/* 77	 M */,
	78	/* 78	 N */,
	79	/* 79	 O */,
	80	/* 80	 P */,
	81	/* 81	 Q */,
	82	/* 82	 R */,
	83	/* 83	 S */,
	84	/* 84	 T */,
	85	/* 85	 U */,
	86	/* 86	 V */,
	87	/* 87	 W */,
	88	/* 88	 X */,
	89	/* 89	 Y */,
	90	/* 90	 Z */,
	91	/* 91	 [ */,
	92	/* 92	 \ */,
	93	/* 93	 ] */,
	94	/* 94	 ^ */,
	95	/* 95	 _ */,
	96	/* 96	 ` */,
	65	/* 97	 a */,
	66	/* 98	 b */,
	67	/* 99	 c */,
	68	/* 100	 d */,
	69	/* 101	 e */,
	70	/* 102	 f */,
	71	/* 103	 g */,
	72	/* 104	 h */,
	73	/* 105	 i */,
	74	/* 106	 j */,
	75	/* 107	 k */,
	76	/* 108	 l */,
	77	/* 109	 m */,
	78	/* 110	 n */,
	79	/* 111	 o */,
	80	/* 112	 p */,
	81	/* 113	 q */,
	82	/* 114	 r */,
	83	/* 115	 s */,
	84	/* 116	 t */,
	85	/* 117	 u */,
	86	/* 118	 v */,
	87	/* 119	 w */,
	88	/* 120	 x */,
	89	/* 121	 y */,
	90	/* 122	 z */,
	123	/* 123	 { */,
	124	/* 124	 | */,
	125	/* 125	 } */,
	126	/* 126	 ~ */,
	127	/* 127	DEL*/,
	128	/* 128	Adieresis*/,
	129	/* 129	Aring*/,
	130	/* 130	Ccedilla*/,
	131	/* 131	Eacute*/,
	132	/* 132	Ntilda*/,
	133	/* 133	Odieresis*/,
	134	/* 134	Udieresis*/,
	231	/* 135	aacute*/,
	203	/* 136	agrave*/,
	229	/* 137	acircumflex*/,
	128	/* 138	adieresis*/,
	204	/* 139	atilda*/,
	129	/* 140	aring*/,
	130	/* 141	ccedilla*/,
	131	/* 142	eacute*/,
	233	/* 143	egrave*/,
	230	/* 144	ecircumflex*/,
	232	/* 145	edieresis*/,
	234	/* 146	iacute*/,
	237	/* 147	igrave*/,
	235	/* 148	icircumflex*/,
	236	/* 149	idieresis*/,
	132	/* 150	ntilda*/,
	238	/* 151	oacute*/,
	241	/* 152	ograve*/,
	239	/* 153	ocircumflex*/,
	133	/* 154	odieresis*/,
	205	/* 155	otilda*/,
	242	/* 156	uacute*/,
	244	/* 157	ugrave*/,
	243	/* 158	ucircumflex*/,
	134	/* 159	udieresis*/,
	160	/* 160	daggar*/,
	161	/* 161	ring*/,
	162	/* 162	cent*/,
	163	/* 163	sterling*/,
	164	/* 164	section*/,
	165	/* 165	bullet*/,
	166	/* 166	paragraph*/,
	167	/* 167	germandbls*/,
	168	/* 168	registered*/,
	169	/* 169	copyright*/,
	170	/* 170	trademark*/,
	171	/* 171	acute*/,
	172	/* 172	dieresis*/,
	173	/* 173	notequal*/,
	174	/* 174	AE*/,
	175	/* 175	Oslash*/,
	176	/* 176	infinity*/,
	177	/* 177	plusminus*/,
	178	/* 178	lessequal*/,
	179	/* 179	greaterequal*/,
	180	/* 180	yen*/,
	181	/* 181	mu*/,
	198	/* 182	delta*/,
	183	/* 183	Sigma*/,
	184	/* 184	Pi*/,
	184	/* 185	pi*/,
	186	/* 186	intergral*/,
	187	/* 187	ordfeminine*/,
	188	/* 188	ordmasculine*/,
	189	/* 189	Omega*/,
	174	/* 190	ae*/,
	175	/* 191	oslash*/,
	192	/* 192	questiondown*/,
	193	/* 193	exclamdown*/,
	194	/* 194	not*/,
	195	/* 195	radical*/,
	196	/* 196	florin*/,
	197	/* 197	aprox*/,
	198	/* 198	Delta*/,
	199	/* 199	guillemotleft*/,
	200	/* 200	guillemotright*/,
	201	/* 201	ellipsis*/,
	202	/* 202	*/,
	203	/* 203	Agrave*/,
	204	/* 204	Atilda*/,
	205	/* 205	Otilda*/,
	206	/* 206	OE*/,
	206	/* 207	oe*/,
	208	/* 208	endash*/,
	209	/* 209	emdash*/,
	210	/* 210	quotedblleft*/,
	211	/* 211	quotedblright*/,
	212	/* 212	quoteleft*/,
	213	/* 213	quoteright*/,
	214	/* 214	divide*/,
	215	/* 215	diamond*/,
	217	/* 216	ydieresis*/,
	217	/* 217	Ydieresis*/,
	218	/* 218	fraction*/,
	219	/* 219	currency*/,
	220	/* 220	guilsinglleft*/,
	221	/* 221	guilsinglright*/,
	222	/* 222	fi*/,
	223	/* 223	fl*/,
	224	/* 224	daggardbl*/,
	225	/* 225	periodcentered*/,
	226	/* 226	quotesinglbase*/,
	227	/* 227	quotedblbase*/,
	228	/* 228	perthousand*/,
	229	/* 229	Acircumflex*/,
	230	/* 230	Ecircumflex*/,
	231	/* 231	Aaccute*/,
	232	/* 232	Edieresis*/,
	233	/* 233	Egrave*/,
	234	/* 234	Iaccute*/,
	235	/* 235	Icircumflex*/,
	236	/* 236	Idieresis*/,
	237	/* 237	Igrave*/,
	238	/* 238	Oaccute*/,
	239	/* 239	Ocircumflex*/,
	240	/* 240	apple*/,
	241	/* 241	Ograve*/,
	242	/* 242	Uaccute*/,
	243	/* 243	Ucircumflex*/,
	244	/* 244	Ugrave*/,
	245	/* 245	dotlessi*/,
	246	/* 246	circumflex*/,
	247	/* 247	tilda*/,
	248	/* 248	macron*/,
	249	/* 249	breve*/,
	250	/* 250	dotaccent*/,
	251	/* 251	ring*/,
	252	/* 252	cedilla*/,
	253	/* 253	hungarumlaut*/,
	254	/* 254	ogonek*/,
	255	/* 255	caron*/,
};

const int	_dialowermap[] = {
	/* map	value	name */
	0	/* 0	NUL*/,
	1	/* 1	SOH*/,
	2	/* 2	STX*/,
	3	/* 3	ETX*/,
	4	/* 4	EOT*/,
	5	/* 5	ENQ*/,
	6	/* 6	ACK*/,
	7	/* 7	BEL*/,
	8	/* 8	BS*/,
	9	/* 9	HT*/,
	10	/* 10	NL*/,
	11	/* 11	VT*/,
	12	/* 12	NP*/,
	13	/* 13	CR*/,
	14	/* 14	SO*/,
	15	/* 15	SI*/,
	16	/* 16	DLE*/,
	17	/* 17	DC1*/,
	18	/* 18	DC2*/,
	19	/* 19	DC3*/,
	20	/* 20	DC4*/,
	21	/* 21	NAK*/,
	22	/* 22	SYN*/,
	23	/* 23	ETB*/,
	24	/* 24	CAN*/,
	25	/* 25	EM*/,
	26	/* 26	SUB*/,
	27	/* 27	ESC*/,
	28	/* 28	FS*/,
	29	/* 29	GS*/,
	30	/* 30	RS*/,
	31	/* 31	US*/,
	32	/* 32	SP*/,
	33	/* 33	 ! */,
	34	/* 34	 " */,
	35	/* 35	 # */,
	36	/* 36	 $ */,
	37	/* 37	 % */,
	38	/* 38	 & */,
	39	/* 39	 ' */,
	40	/* 40	 ( */,
	41	/* 41	 ) */,
	42	/* 42	 * */,
	43	/* 43	 + */,
	44	/* 44	 , */,
	45	/* 45	 - */,
	46	/* 46	 . */,
	47	/* 47	 / */,
	48	/* 48	 0 */,
	49	/* 49	 1 */,
	50	/* 50	 2 */,
	51	/* 51	 3 */,
	52	/* 52	 4 */,
	53	/* 53	 5 */,
	54	/* 54	 6 */,
	55	/* 55	 7 */,
	56	/* 56	 8 */,
	57	/* 57	 9 */,
	58	/* 58	 : */,
	59	/* 59	 ; */,
	60	/* 60	 < */,
	61	/* 61	 = */,
	62	/* 62	 > */,
	63	/* 63	 ? */,
	64	/* 64	 @ */,
	97	/* 65    A */,
	98	/* 66    B */,
	99	/* 67    C */,
	100	/* 68    D */,
	101	/* 69	 E */,
	102	/* 70	 F */,
	103	/* 71	 G */,
	104	/* 72  	 H */,
	105	/* 73	 I */,
	106	/* 74	 J */,
	107	/* 75    K */,
	108	/* 76    L */,
	109	/* 77    M */,
	110	/* 78    N */,
	111	/* 79    O */,
	112	/* 80    P */,
	113	/* 81    Q */,
	114	/* 82    R */,
	115	/* 83    S */,
	116	/* 84    T */,
	117	/* 85    U */,
	118	/* 86    V */,
	119	/* 87    W */,
	120	/* 88    X */,
	121	/* 89    Y */,
	122	/* 90    Z */,
	91	/* 91	 [ */,
	92	/* 92	 \ */,
	93	/* 93	 ] */,
	94	/* 94	 ^ */,
	95	/* 95	 _ */,
	96	/* 96	 ` */,
	97	/* 97    a */,
	98	/* 98    b */,
	99	/* 99    c */,
	100	/* 100   d */,
	101	/* 101   e */,
	102	/* 102	 f */,
	103	/* 103	 g */,
	104	/* 104 	 h */,
	105	/* 105	 i */,
	106	/* 106	 j */,
	107	/* 107   k */,
	108	/* 108   l */,
	109	/* 109   m */,
	110	/* 110   n */,
	111	/* 111   o */,
	112	/* 112   p */,
	113	/* 113   q */,
	114	/* 114   r */,
	115	/* 115   s */,
	116	/* 116   t */,
	117	/* 117   u */,
	118	/* 118   v */,
	119	/* 119   w */,
	120	/* 120   x */,
	121	/* 121   y */,
	122	/* 122   z */,
	123	/* 123	 { */,
	124	/* 124	 | */,
	125	/* 125	 } */,
	126	/* 126	 ~ */,
	127	/* 127	DEL*/,
	138	/* 128	Adieresis*/,
	140	/* 129	Aring*/,
	141	/* 130	Ccedilla*/,
	142	/* 131	Eacute*/,
	150	/* 132	Ntilda*/,
	154	/* 133	Odieresis*/,
	159	/* 134	Udieresis*/,
	135	/* 135	aacute*/,
	136	/* 136	agrave*/,
	137	/* 137	acircumflex*/,
	138	/* 138	adieresis*/,
	139	/* 139	atilda*/,
	140	/* 140	aring*/,
	141	/* 141	ccedilla*/,
	142	/* 142	eacute*/,
	143	/* 143	egrave*/,
	144	/* 144	ecircumflex*/,
	145	/* 145	edieresis*/,
	146	/* 146	iacute*/,
	147	/* 147	igrave*/,
	148	/* 148	icircumflex*/,
	149	/* 149	idieresis*/,
	132	/* 150	ntilda*/,
	151	/* 151	oacute*/,
	152	/* 152	ograve*/,
	153	/* 153	ocircumflex*/,
	154	/* 154	odieresis*/,
	155	/* 155	otilda*/,
	156	/* 156	uacute*/,
	157	/* 157	ugrave*/,
	158	/* 158	ucircumflex*/,
	159	/* 159	udieresis*/,
	160	/* 160	daggar*/,
	161	/* 161	ring*/,
	162	/* 162	cent*/,
	163	/* 163	sterling*/,
	164	/* 164	section*/,
	165	/* 165	bullet*/,
	166	/* 166	paragraph*/,
	167	/* 167	germandbls*/,
	168	/* 168	registered*/,
	169	/* 169	copyright*/,
	170	/* 170	trademark*/,
	171	/* 171	acute*/,
	172	/* 172	dieresis*/,
	173	/* 173	notequal*/,
	190	/* 174	AE*/,
	191	/* 175	Oslash*/,
	176	/* 176	infinity*/,
	177	/* 177	plusminus*/,
	178	/* 178	lessequal*/,
	179	/* 179	greaterequal*/,
	180	/* 180	yen*/,
	181	/* 181	mu*/,
	198	/* 182	delta*/,
	183	/* 183	Sigma*/,
	185	/* 184	Pi*/,
	185	/* 185	pi*/,
	186	/* 186	intergral*/,
	187	/* 187	ordfeminine*/,
	188	/* 188	ordmasculine*/,
	189	/* 189	Omega*/,
	190	/* 190	ae*/,
	191	/* 191	oslash*/,
	192	/* 192	questiondown*/,
	193	/* 193	exclamdown*/,
	194	/* 194	not*/,
	195	/* 195	radical*/,
	196	/* 196	florin*/,
	197	/* 197	aprox*/,
	198	/* 198	Delta*/,
	199	/* 199	guillemotleft*/,
	200	/* 200	guillemotright*/,
	201	/* 201	ellipsis*/,
	202	/* 202	*/,
	136	/* 203	Agrave*/,
	139	/* 204	Atilda*/,
	155	/* 205	Otilda*/,
	207	/* 206	OE*/,
	207	/* 207	oe*/,
	208	/* 208	endash*/,
	209	/* 209	emdash*/,
	210	/* 210	quotedblleft*/,
	211	/* 211	quotedblright*/,
	212	/* 212	quoteleft*/,
	213	/* 213	quoteright*/,
	214	/* 214	divide*/,
	215	/* 215	diamond*/,
	217	/* 216	ydieresis*/,
	217	/* 217	Ydieresis*/,
	218	/* 218	fraction*/,
	219	/* 219	currency*/,
	220	/* 220	guilsinglleft*/,
	221	/* 221	guilsinglright*/,
	222	/* 222	fi*/,
	223	/* 223	fl*/,
	224	/* 224	daggardbl*/,
	225	/* 225	periodcentered*/,
	226	/* 226	quotesinglbase*/,
	227	/* 227	quotedblbase*/,
	228	/* 228	perthousand*/,
	137	/* 229	Acircumflex*/,
	144	/* 230	Ecircumflex*/,
	135	/* 231	Aacute*/,
	145	/* 232	Edieresis*/,
	143	/* 233	Egrave*/,
	146	/* 234	Iaccute*/,
	148	/* 235	Icircumflex*/,
	149	/* 236	Idieresis*/,
	147	/* 237	Igrave*/,
	151	/* 238	Oacute*/,
	153	/* 239	Ocircumflex*/,
	240	/* 240	apple*/,
	152	/* 241	Ograve*/,
	156	/* 242	Uacute*/,
	158	/* 243	Ucircumflex*/,
	157	/* 244	Ugrave*/,
	245	/* 245	dotlessi*/,
	246	/* 246	circumflex*/,
	247	/* 247	tilda*/,
	248	/* 248	macron*/,
	249	/* 249	breve*/,
	250	/* 250	dotaccent*/,
	251	/* 251	ring*/,
	252	/* 252	cedilla*/,
	253	/* 253	hungarumlaut*/,
	254	/* 254	ogonek*/,
	255	/* 255	caron*/,
};

int strdiacasecmp( const char *s1, const char *s2 )
{
    while ( _diacasemap[ (unsigned char) *s1 ] ==
	    _diacasemap[ (unsigned char) *s2++ ] ) {
	if ( *s1++ == '\0' ) {
	    return( 0 );
	}
    }
    return( _diacasemap[ (unsigned char) *s1 ] -
	    _diacasemap[ (unsigned char) *--s2 ] );
}

int strndiacasecmp( const char *s1, const char *s2, size_t n )
{
    while ( n > 0 &&
	    _diacasemap[ (unsigned char) *s1 ] ==
	    _diacasemap[ (unsigned char) *s2++ ] ) {
	if ( *s1++ == '\0' ) {
	    return( 0 );
	}
	n--;
    }

    if (n == 0)
	return 0;
    return _diacasemap[ (unsigned char) *s1 ] -
	   _diacasemap[ (unsigned char) *--s2 ];
}