Minor fixes to comments.
[AROS.git] / rom / filesys / afs / extstrings.c
blobeaa171fb1e076f2dcf189d6c2daa02aa37dc9df7
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "extstrings.h"
8 UBYTE capitalch(UBYTE ch, UBYTE flags) {
10 if ((flags==0) || (flags==1))
11 return (UBYTE)((ch>='a') && (ch<='z') ? ch-('a'-'A') : ch);
12 else // DOS\(>=2)
13 return (UBYTE)(((ch>=224) && (ch<=254) && (ch!=247)) ||
14 ((ch>='a') && (ch<='z')) ? ch-('a'-'A') : ch);
17 // str2 is a BCPL string
18 LONG noCaseStrCmp(const char *str1, const char *str2, UBYTE flags, int maxlen) {
19 UBYTE length, i=0;
21 length=str2++[0];
22 do {
23 if (((*str1==0) || (length==maxlen)) && (i==length))
24 return 1;
25 i++;
26 } while (capitalch(*str1++,flags)==capitalch(*str2++,flags));
27 return 0;
30 LONG StrCmp(CONST_STRPTR str1, CONST_STRPTR str2) {
33 if ((*str1==0) && (*str2==0))
34 return 1;
35 } while ((*str1++==*str2++));
36 return 0;
39 void StrCpyToBstr(const char *src, char *dst, int maxlen) {
40 UWORD len=0;
42 while (*src && (len<maxlen))
44 dst[len+1]=*src++;
45 len++;
47 dst[0]=len;