File: strcasecmp.c

package info (click to toggle)
tetex-bin 1.0.7%2B20011202-7.3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 45,604 kB
  • ctags: 32,286
  • sloc: ansic: 254,806; cpp: 195,997; sh: 17,818; perl: 9,319; makefile: 3,461; yacc: 1,918; pascal: 1,328; awk: 986; asm: 851; lex: 813; sed: 511; lisp: 276; csh: 47
file content (31 lines) | stat: -rw-r--r-- 606 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
#include "dialogconfig.h"

/* GNU Library doesn't have toupper().  Until GNU gets this fixed, I will
   have to do it. */
#ifndef toupper
#define toupper(c) ((c) - 32)
#endif

#define coerce_to_upper(c) ((islower(c) ? toupper(c) : (c)))

#if !defined (HAVE_STRCASECMP)
int strcasecmp (char *string1, char * string2)
{
  char ch1, ch2;

  for (;;)
    {
      ch1 = *string1++;
      ch2 = *string2++;

      if (!(ch1 | ch2))
        return (0);

      ch1 = coerce_to_upper (ch1);
      ch2 = coerce_to_upper (ch2);

      if (ch1 != ch2)
        return (ch1 - ch2);
    }
}
#endif /* !HAVE_STRCASECMP */