R
Richard Heathfield
Ian Collins said:
int casetest(const char *s, const char *t)
{
int diff = 0;
while(diff == 0 && *s != '\0' && *t != '\0')
{
if(tolower((unsigned char)*s++) != tolower((unsigned char)*t++))
{
diff = 1;
}
}
if(*s != '\0' || *t != '\0')
{
diff = 1;
}
return diff;
}
int underscoretest(const char *s, const char *t)
{
int diff = 0;
while(diff == 0 && *s != '\0' && *t != '\0')
{
while(*s == '_')
{
++s;
}
while(*t == '_')
{
++t;
}
if(*s++ != *t++)
{
diff = 1;
}
}
return diff;
}
etc etc ad nauseam.
Roberto Waltman wrote:
What a daft rule! I'd like to see a tool that can enforce that one.
int casetest(const char *s, const char *t)
{
int diff = 0;
while(diff == 0 && *s != '\0' && *t != '\0')
{
if(tolower((unsigned char)*s++) != tolower((unsigned char)*t++))
{
diff = 1;
}
}
if(*s != '\0' || *t != '\0')
{
diff = 1;
}
return diff;
}
int underscoretest(const char *s, const char *t)
{
int diff = 0;
while(diff == 0 && *s != '\0' && *t != '\0')
{
while(*s == '_')
{
++s;
}
while(*t == '_')
{
++t;
}
if(*s++ != *t++)
{
diff = 1;
}
}
return diff;
}
etc etc ad nauseam.