Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 529 → Rev 530

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