www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

string.h (306B)


      1 #ifndef STRING_H
      2 #define STRING_H
      3 
      4 #include <types.h>
      5 
      6 int strcmp(StringZ s1, StringZ s2) {
      7 	while (*s1 == *s2 && *s1 != 0) {
      8 		s1++;
      9 		s2++;
     10 	}
     11 	if (*s1 == *s2)
     12 		return 0;
     13 	else if (*s1 < *s2)
     14 		return -1;
     15 	else
     16 		return 1;
     17 }
     18 
     19 bool streq(StringZ s1, StringZ s2) {
     20 	return (strcmp(s1,s2) == 0);
     21 }
     22 
     23 #endif