~ubuntu-branches/ubuntu/lucid/x11-apps/lucid

« back to all changes in this revision

Viewing changes to xedit/strcasecmp.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Cristau
  • Date: 2008-09-23 00:24:45 UTC
  • mfrom: (1.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080923002445-mb2rwkif45zz1vlj
Tags: 7.3+4
* Remove xedit from the package, it's unmaintained and broken
  (closes: #321434).
* Remove xedit's conffiles on upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $XFree86: xc/programs/xedit/strcasecmp.c,v 1.1 1999/06/14 02:38:07 dawes Exp $ */
2
 
 
3
 
#include <ctype.h>
4
 
#include <sys/types.h>
5
 
 
6
 
#ifndef LISP
7
 
#include "xedit.h"
8
 
#endif
9
 
 
10
 
/* Just like the BSD version.  It assumes that tolower() is ANSI-compliant */
11
 
 
12
 
int
13
 
strcasecmp(const char *s1, const char *s2)
14
 
{
15
 
        const unsigned char *us1 = (const unsigned char *)s1;
16
 
        const unsigned char *us2 = (const unsigned char *)s2;
17
 
 
18
 
        while (tolower(*us1) == tolower(*us2++))
19
 
                if (*us1++ == '\0')
20
 
                        return 0;
21
 
        return tolower(*us1) - tolower(*--us2);
22
 
}
23
 
 
24
 
int
25
 
strncasecmp(const char *s1, const char *s2, size_t n)
26
 
{
27
 
        if (n != 0) {
28
 
                const unsigned char *us1 = (const unsigned char *)s1;
29
 
                const unsigned char *us2 = (const unsigned char *)s2;
30
 
 
31
 
                do {
32
 
                        if (tolower(*us1) != tolower(*us2++))
33
 
                                return tolower(*us1) - tolower(*--us2);
34
 
                        if (*us1++ == '\0')
35
 
                                break;
36
 
                } while (--n != 0);
37
 
        }
38
 
        return 0;
39
 
}
40