/[cvs]/ccvs/lib/strncasecmp.c
ViewVC logotype

Diff of /ccvs/lib/strncasecmp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by dprice, Mon Sep 19 21:26:14 2005 UTC revision 1.4 by dprice, Thu Oct 20 21:06:01 2005 UTC
# Line 1  Line 1 
1  /* strncasecmp.c -- case insensitive string comparator  /* strncasecmp.c -- case insensitive string comparator
2     Copyright (C) 1998, 1999 Free Software Foundation, Inc.     Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
3    
4     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 23  Line 23 
23  #include "strcase.h"  #include "strcase.h"
24    
25  #include <ctype.h>  #include <ctype.h>
26    #include <limits.h>
27    
28  #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))  #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
29    
# Line 54  strncasecmp (const char *s1, const char Line 55  strncasecmp (const char *s1, const char
55      }      }
56    while (c1 == c2);    while (c1 == c2);
57    
58    return c1 - c2;    if (UCHAR_MAX <= INT_MAX)
59        return c1 - c2;
60      else
61        /* On machines where 'char' and 'int' are types of the same size, the
62           difference of two 'unsigned char' values - including the sign bit -
63           doesn't fit in an 'int'.  */
64        return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
65  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26