Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 530 → Rev 529

/svarcom/trunk/helpers.c
38,10 → 38,9
#include "helpers.h"
 
 
/* case-insensitive comparison of strings, compares up to maxlen characters.
* returns non-zero on equality. */
int imatchlim(const char *s1, const char *s2, unsigned short maxlen) {
while (maxlen--) {
/* case-insensitive comparison of strings, returns non-zero on equality */
int imatch(const char *s1, const char *s2) {
for (;;) {
char c1, c2;
c1 = *s1;
c2 = *s2;
49,11 → 48,10
if ((c2 >= 'a') && (c2 <= 'z')) c2 -= ('a' - 'A');
/* */
if (c1 != c2) return(0);
if (c1 == 0) break;
if (c1 == 0) return(1);
s1++;
s2++;
}
return(1);
}
 
 
/svarcom/trunk/helpers.h
25,12 → 25,9
#ifndef HELPERS_H
#define HELPERS_H
 
/* case-insensitive comparison of strings, compares up to maxlen characters.
* returns non-zero on equality. */
int imatchlim(const char *s1, const char *s2, unsigned short maxlen);
/* case-insensitive comparison of strings, returns non-zero on equality */
int imatch(const char *s1, const char *s2);
 
#define imatch(a,b) imatchlim(a,b,0xffff)
 
/* returns zero if s1 starts with s2 */
int strstartswith(const char *s1, const char *s2);