dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/support strings.c,1.1.1.1,1.2


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/support strings.c,1.1.1.1,1.2
Date: Tue, 08 Jul 2003 06:14:40 -0400

Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv6722/support

Modified Files:
        strings.c 
Log Message:


Add "ILStrNICmp" as a common support function.


Index: strings.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/strings.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** strings.c   13 Aug 2001 05:25:00 -0000      1.1.1.1
--- strings.c   8 Jul 2003 10:14:37 -0000       1.2
***************
*** 70,73 ****
--- 70,117 ----
  }
  
+ int ILStrNICmp(const char *str1, const char *str2, int len)
+ {
+       char ch1;
+       char ch2;
+       while(len > 0 && *str1 != '\0' && *str2 != '\0')
+       {
+               ch1 = *str1++;
+               if(ch1 >= 'A' && ch1 <= 'Z')
+               {
+                       ch1 = (ch1 - 'A' + 'a');
+               }
+               ch2 = *str2++;
+               if(ch2 >= 'A' && ch2 <= 'Z')
+               {
+                       ch2 = (ch2 - 'A' + 'a');
+               }
+               if(ch1 < ch2)
+               {
+                       return -1;
+               }
+               else if(ch1 > ch2)
+               {
+                       return 1;
+               }
+               --len;
+       }
+       if(!len)
+       {
+               return 0;
+       }
+       if(*str1 != '\0')
+       {
+               return 1;
+       }
+       else if(*str2 != '\0')
+       {
+               return -1;
+       }
+       else
+       {
+               return 0;
+       }
+ }
+ 
  #ifdef        __cplusplus
  };





reply via email to

[Prev in Thread] Current Thread [Next in Thread]