Subversion Repositories SvarDOS

Rev

Rev 445 | Rev 538 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 445 Rev 530
Line 36... Line 36...
36
#include "env.h"
36
#include "env.h"
37
 
37
 
38
#include "helpers.h"
38
#include "helpers.h"
39
 
39
 
40
 
40
 
41
/* case-insensitive comparison of strings, returns non-zero on equality */
41
/* case-insensitive comparison of strings, compares up to maxlen characters.
-
 
42
 * returns non-zero on equality. */
42
int imatch(const char *s1, const char *s2) {
43
int imatchlim(const char *s1, const char *s2, unsigned short maxlen) {
43
  for (;;) {
44
  while (maxlen--) {
44
    char c1, c2;
45
    char c1, c2;
45
    c1 = *s1;
46
    c1 = *s1;
46
    c2 = *s2;
47
    c2 = *s2;
47
    if ((c1 >= 'a') && (c1 <= 'z')) c1 -= ('a' - 'A');
48
    if ((c1 >= 'a') && (c1 <= 'z')) c1 -= ('a' - 'A');
48
    if ((c2 >= 'a') && (c2 <= 'z')) c2 -= ('a' - 'A');
49
    if ((c2 >= 'a') && (c2 <= 'z')) c2 -= ('a' - 'A');
49
    /* */
50
    /* */
50
    if (c1 != c2) return(0);
51
    if (c1 != c2) return(0);
51
    if (c1 == 0) return(1);
52
    if (c1 == 0) break;
52
    s1++;
53
    s1++;
53
    s2++;
54
    s2++;
54
  }
55
  }
-
 
56
  return(1);
55
}
57
}
56
 
58
 
57
 
59
 
58
/* returns zero if s1 starts with s2 */
60
/* returns zero if s1 starts with s2 */
59
int strstartswith(const char *s1, const char *s2) {
61
int strstartswith(const char *s1, const char *s2) {