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

Defined functions

cistrncmp defined in line 63; used 2 times

Defined variables

charmap defined in line 17; used 2 times
sccsid defined in line 2; never used
Last modified: 1986-06-04
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 915
Valid CSS Valid XHTML 1.0 Strict