case.c

Go to the documentation of this file.
00001 #include <grass/dbmi.h>
00002 
00009 void db_char_to_lowercase(char *s)
00010 {
00011     if (*s >= 'A' && *s <= 'Z')
00012         *s -= 'A' - 'a';
00013 }
00014 
00021 void db_char_to_uppercase(char *s)
00022 {
00023     if (*s >= 'a' && *s <= 'z')
00024         *s += 'A' - 'a';
00025 }
00026 
00033 void db_Cstring_to_lowercase(char *s)
00034 {
00035     while (*s)
00036         db_char_to_lowercase(s++);
00037 }
00038 
00045 void db_Cstring_to_uppercase(char *s)
00046 {
00047     while (*s)
00048         db_char_to_uppercase(s++);
00049 }
00050 
00057 int db_nocase_compare(const char *a, const char *b)
00058 {
00059     char s, t;
00060 
00061     while (*a && *b) {
00062         s = *a++;
00063         t = *b++;
00064         db_char_to_uppercase(&s);
00065         db_char_to_uppercase(&t);
00066         if (s != t)
00067             return 0;
00068     }
00069     return (*a == 0 && *b == 0);
00070 }

Generated on Sat Oct 24 03:24:24 2009 for GRASS Programmer's Manual by  doxygen 1.6.1