fprintf (out,"%c\n",COMMENTSIGN);
}
+
int gmx_strcasecmp_min(const char *str1, const char *str2)
{
- char ch1,ch2;
-
- do
+ char ch1,ch2;
+
+ do
{
- do
- ch1=toupper(*(str1++));
- while ((ch1=='-') || (ch1=='_'));
- do
- ch2=toupper(*(str2++));
- while ((ch2=='-') || (ch2=='_'));
- if (ch1!=ch2) return (ch1-ch2);
+ do
+ {
+ ch1=toupper(*(str1++));
+ }
+ while ((ch1=='-') || (ch1=='_'));
+ do
+ {
+ ch2=toupper(*(str2++));
+ }
+ while ((ch2=='-') || (ch2=='_'));
+
+ if (ch1!=ch2) return (ch1-ch2);
}
- while (ch1);
- return 0;
+ while (ch1);
+ return 0;
}
int gmx_strncasecmp_min(const char *str1, const char *str2, int n)
{
- char ch1,ch2;
- char *stri1, *stri2;
+ char ch1,ch2;
+ char *stri1, *stri2;
- stri1=(char *)str1;
- stri2=(char *)str2;
- do
+ stri1=(char *)str1;
+ stri2=(char *)str2;
+ do
{
- do
- ch1=toupper(*(str1++));
- while ((ch1=='-') || (ch1=='_'));
- do
- ch2=toupper(*(str2++));
- while ((ch2=='-') || (ch2=='_'));
- if (ch1!=ch2) return (ch1-ch2);
+ do
+ {
+ ch1=toupper(*(str1++));
+ }
+ while ((ch1=='-') || (ch1=='_'));
+ do
+ {
+ ch2=toupper(*(str2++));
+ }
+ while ((ch2=='-') || (ch2=='_'));
+
+ if (ch1!=ch2) return (ch1-ch2);
}
- while (ch1 && (str1-stri1<n) && (str2-stri2<n));
+ while (ch1 && (str1-stri1<n) && (str2-stri2<n));
return 0;
}
return dest;
}
+/* Magic hash init number for Dan J. Bernsteins algorithm.
+ * Do NOT use any other value unless you really know what you are doing.
+ */
+const unsigned int
+gmx_string_hash_init = 5381;
+
+
+unsigned int
+gmx_string_hash_func(const char *s, unsigned int hash_init)
+{
+ int c;
+
+ while ((c = toupper(*s++)) != '\0')
+ {
+ if(isalnum(c)) hash_init = ((hash_init << 5) + hash_init) ^ c; /* (hash * 33) xor c */
+ }
+ return hash_init;
+}
+
int
gmx_wcmatch(const char *pattern, const char *str)
{