fp = fopen(public_clients_file, "r");
if (fp != NULL) while (fgets(buf, sizeof buf, fp)!=NULL) {
- for (i=0; i<strlen(buf); ++i) {
+ char *ptr;
+ ptr = buf;
+ while (!IsEmptyStr(*ptr)) {
if (buf[i] == '#') buf[i] = 0;
+ else ptr++;
}
while (isspace((buf[strlen(buf)-1]))) {
buf[strlen(buf)-1] = 0;
if (CtdlAccessCheck(ac_aide)) return;
extract_token(buf, mname, 0, '|', sizeof buf);
- for (a=0; a<strlen(buf); ++a) { /* security measure */
+ for (a=0; !IsEmptyStr(&buf[a]); ++a) { /* security measure */
if (buf[a] == '/') buf[a] = '.';
}
/* if it's time to word wrap, send a partial line */
if (strlen(wbuf) >= (77 - strlen(fullname))) {
pos = 0;
- for (a = 0; a < strlen(wbuf); ++a) {
+ for (a = 0; !IsEmptyStr(&wbuf[a]); ++a) {
if (wbuf[a] == 32)
pos = a;
}
vsnprintf(buf, sizeof(buf), format, arg_ptr);
va_end(arg_ptr);
- for (i=0; i<strlen(buf); ++i) {
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) {
scr_putc(buf[i]);
if (buf[i]==10) {
++lines_printed;
scr_printf("%s", str);
}
else {
- for (i=0; i<strlen(str); ++i) {
+ for (i=0; !IsEmptyStr(&str[i]); ++i) {
scr_printf("*");
}
}
snprintf(buf, sizeof buf, "%d", i);
strprompt(prompt, buf, 15);
i = atoi(buf);
- for (p=0; p<strlen(buf); ++p) {
+ for (p=0; !IsEmptyStr(&buf[p]); ++p) {
if ( (!isdigit(buf[p]))
&& ( (buf[p]!='-') || (p!=0) ) )
i = imin - 1;
{
int a;
- for (a = 0; a < strlen(cmdstr); ++a)
+ for (a = 0; !IsEmptyStr(&cmdstr[a]); ++a)
if (cmdstr[a] == '&')
return (tolower(cmdstr[a + 1]));
return (0);
int a;
static char exp[64];
char buf[1024];
+ char *ptr;
strcpy(exp, strbuf);
- for (a = 0; a < strlen(exp); ++a) {
- if (strbuf[a] == '&') {
+ ptr = exp;
+ while (!IsEmptyStr(ptr)){
+ if (*ptr == '&') {
/* dont echo these non mnemonic command keys */
- int noecho = strbuf[a+1] == '<' || strbuf[a+1] == '>' || strbuf[a+1] == '+' || strbuf[a+1] == '-';
+ int noecho = *(ptr+1) == '<' || *(ptr+1) == '>' ||
+ *(ptr+1) == '+' || *(ptr+1) == '-';
if (mode == 0) {
- strcpy(&exp[a], &exp[a + 1 + noecho]);
+ strcpy(ptr, ptr + 1 + noecho);
}
if (mode == 1) {
- exp[a] = '<';
- strcpy(buf, &exp[a + 2]);
- exp[a + 2] = '>';
- exp[a + 3] = 0;
+ *ptr = '<';
+ strcpy(buf, ptr + 2);
+ *(ptr + 2) = '>';
+ *(ptr+ 3) = 0;
strcat(exp, buf);
}
}
- if (!strncmp(&exp[a], "^r", 2)) {
+ if (!strncmp(ptr, "^r", 2)) {
strcpy(buf, exp);
- strcpy(&exp[a], room_name);
- strcat(exp, &buf[a + 2]);
+ strcpy(ptr, room_name);
+ strcat(exp, &buf[ptr - exp + 2]);
}
- if (!strncmp(&exp[a], "^c", 2)) {
- exp[a] = ',';
- strcpy(&exp[a + 1], &exp[a + 2]);
+ if (!strncmp(ptr, "^c", 2)) {
+ *ptr = ',';
+ strcpy(ptr + 1], ptr + 2]);
}
}
char buf[64];
strcpy(buf, cptr->c_keys[ncomp - 1]);
- for (a = 0; a < strlen(buf); ++a) {
+ for (a = 0; !IsEmptyStr(&buf[a]); ++a) {
if (buf[a] == ':')
return (1);
}
}
} while (FD_ISSET(0, &rfds));
- for (a = 0; a < strlen(abuf); ++a) {
+ for (a = 0; !IsEmptyStr(&abuf[a]); ++a) {
if ((abuf[a] == 27) && (abuf[a + 1] == '[')
&& (abuf[a + 2] == '?')) {
enable_color = 1;
int i;
color(DIM_WHITE);
- for (i=0; i<strlen(buf); ++i) {
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) {
if (buf[i]=='<') {
pprintf("%c", buf[i]);
color(BRIGHT_MAGENTA);
choices = num_tokens(menustring, '|');
if (menuprompt != NULL) do_prompt = 1;
- if (menuprompt != NULL) if (strlen(menuprompt)==0) do_prompt = 0;
+ if (menuprompt != NULL) if (IsEmptyStr(menuprompt)) do_prompt = 0;
while (1) {
if (display_prompt) {
for (i=0; i<choices; ++i) {
extract_token(buf, menustring, i, '|', sizeof buf);
- for (c=1; c<strlen(buf); ++c) {
+ for (c=1; !IsEmptyStr(&buf[c]); ++c) {
if ( (ch == tolower(buf[c]))
&& (buf[c-1]=='<')
&& (buf[c+1]=='>') ) {
- for (a=0; a<strlen(buf); ++a) {
+ for (a=0; !IsEmptyStr(&buf[a]); ++a) {
if ( (a!=(c-1)) && (a!=(c+1))) {
scr_putc(buf[a]);
}
ERROR + FILE_NOT_FOUND);
return;
}
- for (a = 0; a < strlen(filename); ++a) {
+ for (a = 0; !IsEmptyStr(&filename[a]); ++a) {
if (filename[a] == '/') {
filename[a] = '_';
}
return;
}
- for (a = 0; a < strlen(filename); ++a) {
+ for (a = 0; !IsEmptyStr(&filename[a]); ++a) {
if (filename[a] == '/') {
filename[a] = '_';
}
return;
}
- for (a = 0; a < strlen(filename); ++a) {
+ for (a = 0; !IsEmptyStr(&filename[a]); ++a) {
if (filename[a] == '/') {
filename[a] = '_';
}
return;
}
- for (a = 0; a < strlen(filename); ++a) {
+ for (a = 0; !IsEmptyStr(&filename[a]); ++a) {
if (filename[a] == '/') {
filename[a] = '_';
}
} else if (!strcasecmp(filename, "_roompic_")) {
assoc_file_name(pathname, sizeof pathname, &CC->room, ctdl_image_dir);
} else {
- for (a = 0; a < strlen(filename); ++a) {
+ for (a = 0; !IsEmptyStr(&filename[0]); ++a) {
filename[a] = tolower(filename[a]);
if (filename[a] == '/') {
filename[a] = '_';
return;
}
- for (a = 0; a < strlen(CC->upl_file); ++a) {
+ for (a = 0; !IsEmptyStr(&CC->upl_file[a]); ++a) {
if (CC->upl_file[a] == '/') {
CC->upl_file[a] = '_';
}
strcpy(CC->upl_path, "");
- for (a = 0; a < strlen(basenm); ++a) {
+ for (a = 0; !IsEmptyStr(&basenm[a]); ++a) {
basenm[a] = tolower(basenm[a]);
if (basenm[a] == '/') {
basenm[a] = '_';
if (!IsEmptyStr(inbuf)) {
/* Fold in all the spacing */
- for (i=0; i<strlen(inbuf); ++i) {
+ for (i=0; !IsEmptyStr(&inbuf[i]); ++i) {
if (inbuf[i]==10) inbuf[i]=32;
if (inbuf[i]==13) inbuf[i]=32;
if (inbuf[i]==9) inbuf[i]=32;
inbuf[i] = '?';
} */
}
- for (i=0; i<strlen(inbuf); ++i) {
+ for (i=0; !IsEmptyStr(&inbuf[i]); ++i) {
while ((inbuf[i]==32)&&(inbuf[i+1]==32))
strcpy(&inbuf[i], &inbuf[i+1]);
}
- for (i=0; i<strlen(inbuf); ++i) {
+ for (i=0; !IsEmptyStr(&inbuf[i]); ++i) {
ch = inbuf[i];
}
/* Convert &; tags to the forbidden characters */
- if (!IsEmptyStr(outbuf)) for (i=0; i<strlen(outbuf); ++i) {
+ if (!IsEmptyStr(outbuf)) for (i=0; !IsEmptyStr(&outbuf[i]); ++i) {
/* Character entity references */
if (!strncasecmp(&outbuf[i], " ", 6)) {
do {
did_out = 0;
if (!IsEmptyStr(outbuf)) {
- for (i = 0; i<strlen(outbuf); ++i) {
+ for (i = 0; !IsEmptyStr(&outbuf[i]); ++i) {
if ( (i<(screenwidth-2)) && (outbuf[i]=='\n')) {
strncpy(&outptr[output_len],
*/
int fuzzy_match(struct ctdluser *us, char *matchstring) {
int a;
+ long len;
if ( (!strncasecmp(matchstring, "cit", 3))
&& (atol(&matchstring[3]) == us->usernum)) {
return 0;
}
-
- for (a=0; a<strlen(us->fullname); ++a) {
+ len = strlen(matchstring);
+ for (a=0; !IsEmptyStr(&us->fullname[a]); ++a) {
if (!strncasecmp(&us->fullname[a],
- matchstring, strlen(matchstring))) {
+ matchstring, len)) {
return 0;
}
}
int i;
int keylen = 0;
- for (i=0; i<strlen(addr); ++i) {
+ for (i=0; !IsEmptyStr(&addr[i]); ++i) {
if (!isspace(addr[i])) {
key[keylen++] = tolower(addr[i]);
}
strcat(buf, "@");
strcat(buf, config.c_fqdn);
}
- for (i=0; i<strlen(buf); ++i) {
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) {
if (buf[i]==' ') buf[i] = '_';
}
icalcomponent_add_property(fb, icalproperty_new_organizer(buf));
if (!strncasecmp(which_fields, "HEADER.FIELDS.NOT", 17))
headers_not = 1;
- for (i=0; i<strlen(which_fields); ++i) {
+ for (i=0; !IsEmptyStr(&which_fields[i]); ++i) {
if (which_fields[i]=='(')
strcpy(which_fields, &which_fields[i+1]);
}
- for (i=0; i<strlen(which_fields); ++i) {
- if (which_fields[i]==')')
+ for (i=0; !IsEmptyStr(&which_fields[i]); ++i) {
+ if (which_fields[i]==')') {
which_fields[i] = 0;
+ break;
+ }
}
num_parms = imap_parameterize(parms, which_fields);
int i;
int nest = 0;
- for (i=0; i<strlen(str); ++i) {
+ for (i=0; !IsEmptyStr(&str[i]); ++i) {
if (str[i]=='(') ++nest;
if (str[i]=='[') ++nest;
if (str[i]=='<') ++nest;
int imap_extract_data_items(char **argv, char *items) {
int num_items = 0;
int nest = 0;
- int i, initial_len;
+ int i;
char *start;
/* Convert all whitespace to ordinary space characters. */
- for (i=0; i<strlen(items); ++i) {
+ for (i=0; !IsEmptyStr(&items[i]); ++i) {
if (isspace(items[i])) items[i]=' ';
}
selection_left = 2;
paren_nest = 0;
for (i=2; i<num_parms; ++i) {
- for (j=0; j<strlen(parms[i]); ++j) {
+ for (j=0; !IsEmptyStr(&parms[i][j]); ++j) {
if (parms[i][j] == '(') ++paren_nest;
if (parms[i][j] == ')') --paren_nest;
}
extended_list_in_use = 1;
paren_nest = 0;
for (i=patterns_left; i<num_parms; ++i) {
- for (j=0; j<strlen(parms[i]); ++j) {
+ for (j=0; !IsEmptyStr(&parms[i][j]); ++j) {
if (parms[i][j] == '(') ++paren_nest;
if (parms[i][j] == ')') --paren_nest;
}
extended_list_in_use = 1;
paren_nest = 0;
for (i=return_left; i<num_parms; ++i) {
- for (j=0; j<strlen(parms[i]); ++j) {
+ for (j=0; !IsEmptyStr(&parms[i][j]); ++j) {
if (parms[i][j] == '(') ++paren_nest;
if (parms[i][j] == ')') --paren_nest;
}
free(ptr);
ptr = holdptr;
- for (i=0; i<strlen(dumpomatic); ++i) {
+ for (i=0; !IsEmptyStr(&dumpomatic[i]); ++i) {
if (!isprint(dumpomatic[i])) dumpomatic[i] = ' ';
if (dumpomatic[i]=='\\') dumpomatic[i]='/';
if (dumpomatic[i]=='\"') dumpomatic[i]='\'';
loop:
if (r < 0x80)
{
- *ptr = p;
+ *ptr = (char*) p;
v = r;
break;
}
m<<=5;
} while (r & 0x40);
- *ptr = p;
+ *ptr = (char*)p;
v &= ~m;
break;
{
int i;
int is_literal = 0;
- int len;
+ long len;
if (buf == NULL) { /* yeah, we handle this */
cprintf("NIL");
}
if (is_literal) {
- cprintf("{%ld}\r\n%s", (long)strlen(buf), buf);
+ cprintf("{%ld}\r\n%s", len, buf);
} else {
cprintf("\"%s\"", buf);
}
if (!strcasecmp(buf, "ALL"))
return (1); /* macro? why? */
- for (i = 0; i < strlen(buf); ++i) { /* now start the scan */
+ for (i = 0; !IsEmptyStr(&buf[i]); ++i) { /* now start the scan */
if (
(!isdigit(buf[i]))
&& (buf[i] != ':')
/* We just want the top-level dc, not the whole hierarchy */
strcpy(topdc, config.c_ldap_base_dn);
- for (i=0; i<strlen(topdc); ++i) {
- if (topdc[i] == ',') topdc[i] = 0;
+ for (i=0; !IsEmptyStr(&topdc[i]); ++i) {
+ if (topdc[i] == ',') {
+ topdc[i] = 0;
+ break;
+ }
}
- for (i=0; i<strlen(topdc); ++i) {
+ for (i=0; !IsEmptyStr(&topdc[i]); ++i) {
if (topdc[i] == '=') strcpy(topdc, &topdc[i+1]);
}
snprintf(buf, sizeof buf, "[%s]", CC->room.QRname);
msg->cm_fields['U'] = strdup(buf);
sprintf(buf, "room_%s@%s", CC->room.QRname, config.c_fqdn);
- for (i=0; i<strlen(buf); ++i) {
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) {
if (isspace(buf[i])) buf[i]='_';
buf[i] = tolower(buf[i]);
}
snprintf(msg->cm_fields['R'], 256,
"room_%s@%s", CC->room.QRname,
config.c_fqdn);
- for (i=0; i<strlen(msg->cm_fields['R']); ++i) {
+ for (i=0; !IsEmptyStr(&msg->cm_fields['R'][i]); ++i) {
if (isspace(msg->cm_fields['R'][i])) {
msg->cm_fields['R'][i] = '_';
}
snprintf(msg->cm_fields['F'], SIZ,
"room_%s@%s", CC->room.QRname,
config.c_fqdn);
- for (i=0; i<strlen(msg->cm_fields['F']); ++i) {
+ for (i=0; !IsEmptyStr(&msg->cm_fields['F'][i]); ++i) {
if (isspace(msg->cm_fields['F'][i])) {
msg->cm_fields['F'][i] = '_';
}
/* If we wrote a digest, deliver it and then close it */
snprintf(buf, sizeof buf, "room_%s@%s",
CC->room.QRname, config.c_fqdn);
- for (i=0; i<strlen(buf); ++i) {
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) {
buf[i] = tolower(buf[i]);
if (isspace(buf[i])) buf[i] = '_';
}
while (--a > 0) {
if (!strncasecmp(p, "X-KOrg-Note-Id: ", 16)) { /* Found it */
safestrncpy(uuid, p + 16, sizeof(uuid));
- for (i = 0; i<strlen(uuid); ++i) {
+ for (i = 0; !IsEmptyStr(&uuid[i]); ++i) {
if ( (uuid[i] == '\r') || (uuid[i] == '\n') ) {
uuid[i] = 0;
+ break;
}
}
if (!strncasecmp(buf, "From:", 5)) {
safestrncpy(mailfrom, &buf[5], sizeof mailfrom);
striplt(mailfrom);
- for (i=0; i<strlen(mailfrom); ++i) {
+ for (i=0; !IsEmptyStr(&mailfrom[i]); ++i) {
if (!isprint(mailfrom[i])) {
strcpy(&mailfrom[i], &mailfrom[i+1]);
i=0;
/* Strip out parenthesized names */
lp = (-1);
rp = (-1);
- for (i=0; i<strlen(mailfrom); ++i) {
+ for (i=0; !IsEmptyStr(&mailfrom[i]); ++i) {
if (mailfrom[i] == '(') lp = i;
if (mailfrom[i] == ')') rp = i;
}
/* Prefer brokketized names */
lp = (-1);
rp = (-1);
- for (i=0; i<strlen(mailfrom); ++i) {
+ for (i=0; !IsEmptyStr(&mailfrom[i]); ++i) {
if (mailfrom[i] == '<') lp = i;
if (mailfrom[i] == '>') rp = i;
}
client_getln(buf, sizeof buf);
vbuf.v_lastseen = atol(buf);
- for (i=0; i<strlen(buf); ++i) if (!isdigit(buf[i])) is_textual_seen = 1;
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) if (!isdigit(buf[i])) is_textual_seen = 1;
if (is_textual_seen) strcpy(vbuf.v_seen, buf);
client_getln(vbuf.v_answered, sizeof vbuf.v_answered);
sprintf(buf, "http://%s/%s.vfb",
config.c_fqdn,
usbuf.fullname);
- for (i=0; i<strlen(buf); ++i) {
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) {
if (buf[i] == ' ') buf[i] = '_';
}
vcard_set_prop(v, "FBURL;PREF", buf, 0);
if (a==2) strcpy(tmpcity, buf);
if (a==3) strcpy(tmpstate, buf);
if (a==4) {
- for (c=0; c<strlen(buf); ++c) {
+ for (c=0; !IsEmptyStr(&buf[c]); ++c) {
if ((buf[c]>='0') && (buf[c]<='9')) {
b = strlen(tmpzip);
tmpzip[b] = buf[c];
v = vcard_new();
if (v == NULL) return;
sprintf(buf, "%s@%s", usbuf->fullname, config.c_fqdn);
- for (i=0; i<strlen(buf); ++i) {
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) {
if (buf[i] == ' ') buf[i] = '_';
}
vcard_add_prop(v, "fn", usbuf->fullname);
vcard_set_prop(v, "email;internet", email, 0);
snprintf(uid, sizeof uid, "collected: %s %s@%s", name, user, node);
- for (i=0; i<strlen(uid); ++i) {
+ for (i=0; !IsEmptyStr(&uid[i]); ++i) {
if (isspace(uid[i])) uid[i] = '_';
uid[i] = tolower(uid[i]);
}
}
}
- for (i=0; i<strlen(suser); ++i) {
+ for (i=0; !IsEmptyStr(&suser[i]); ++i) {
suser[i] = tolower(suser[i]);
if (!isalnum(suser[i])) suser[i]='_';
}
else if (!is_room_aide() && (TheMessage->cm_anon_type == MES_ANONOPT)) {
cprintf("From: \"anonymous\" <x@x.org>%s", nl);
}
- else if (strlen(fuser) > 0) {
+ else if (!IsEmptyStr(fuser)) {
cprintf("From: \"%s\" <%s>%s", luser, fuser, nl);
}
else {
if (msg->cm_fields['P'] == NULL) {
if (msg->cm_fields['A'] != NULL) {
msg->cm_fields['P'] = strdup(msg->cm_fields['A']);
- for (a=0; a<strlen(msg->cm_fields['P']); ++a) {
+ for (a=0; !IsEmptyStr(&msg->cm_fields['P'][a]); ++a) {
if (isspace(msg->cm_fields['P'][a])) {
msg->cm_fields['P'][a] = ' ';
}
ret->recptypes_magic = RECPTYPES_MAGIC;
/* Change all valid separator characters to commas */
- for (i=0; i<strlen(recipients); ++i) {
+ for (i=0; !IsEmptyStr(&recipients[i]); ++i) {
if ((recipients[i] == ';') || (recipients[i] == '|')) {
recipients[i] = ',';
}
mailtype = alias(this_recp);
mailtype = alias(this_recp);
mailtype = alias(this_recp);
- for (j=0; j<=strlen(this_recp); ++j) {
+ for (j=0; !IsEmptyStr(&this_recp[j]); ++j) {
if (this_recp[j]=='_') {
this_recp_cooked[j] = ' ';
}
char lowercase_name[ROOMNAMELEN];
char *aptr, *bptr;
long len;
- int a;
aptr = room_name;
bptr = lowercase_name;
if (IsEmptyStr(new_room_name)) {
return;
}
- for (a = 0; a < strlen(new_room_name); ++a) {
+ for (a = 0; !IsEmptyStr(&new_room_name[a]); ++a) {
if (new_room_name[a] == '|') {
new_room_name[a] = '_';
}
new_room_type = b - 1;
if (new_room_type == 2) {
newprompt("Enter a room password: ", new_room_pass, 9);
- for (a = 0; a < strlen(new_room_pass); ++a)
+ for (a = 0; !IsEmptyStr(&new_room_pass[a]); ++a)
if (new_room_pass[a] == '|')
new_room_pass[a] = '_';
} else {
color(COLOR_POP);
stty_ctdl(0);
b=inkey();
- for (a=0; a<strlen(ipc->ServInfo.moreprompt); ++a)
+ for (a=0; !IsEmptyStr(&ipc->ServInfo.moreprompt[0]); ++a)
scr_putc(' ');
scr_putc(13);
stty_ctdl(1);
/* Searches for patn in search string */
int pattern(char *search, char *patn) {
- int a,b;
-
- for (a=0; a<strlen(search); ++a) {
- b=strncasecmp(&search[a],patn,strlen(patn));
+ int a,b,len;
+
+ len = strlen(patn);
+ for (a=0; !IsEmptyStr(&search[a]); ++a) {
+ b=strncasecmp(&search[a],patn,len);
if (b==0) return(b);
}
return(-1);
if (IsEmptyStr(string)) return;
/* Convert non-printable characters to blanks */
- for (a=0; a<strlen(string); ++a) {
+ for (a=0; !IsEmptyStr(&string[a]); ++a) {
if (string[a]<32) string[a]=32;
if (string[a]>126) string[a]=32;
}
pclose(who);
b = 0;
- for (a=0; a<strlen(buf); ++a) {
+ for (a=0; !IsEmptyStr(&buf[a]); ++a) {
if ((buf[a]=='(')||(buf[a]==')')) ++b;
}
if (b<2) {
else
newprompt("Enter filename: ", flnm, 15);
- for (a = 0; a < strlen(flnm); ++a)
+ for (a = 0; !IsEmptyStr(&flnm[0]); ++a)
if ((flnm[a] == '/') || (flnm[a] == '\\') || (flnm[a] == '>')
|| (flnm[a] == '?') || (flnm[a] == '*')
|| (flnm[a] == ';') || (flnm[a] == '&'))
pprintf("%s\n", buf);
return;
}
- while (resp && strlen(resp)) {
+ while (resp && !IsEmptyStr(resp)) {
extract_token(buf, resp, 0, '\n', sizeof buf);
remove_token(resp, 0, '\n');
if ((pos + strlen(buf) + 5) > screenwidth) {
if (IsEmptyStr(string)) return;
/* Convert non-printable characters to blanks */
- for (a=0; a<strlen(string); ++a) {
+ for (a=0; !IsEmptyStr(&string[a]); ++a) {
if (string[a]<32) string[a]=32;
if (string[a]>126) string[a]=32;
}
string[strlen(string)-1]=0;
/* Remove double blanks */
- for (a=0; a<strlen(string); ++a) {
+ for (a=0; !IsEmptyStr(&string[a]); ++a) {
if ((string[a]==32)&&(string[a+1]==32)) {
strcpy(&string[a],&string[a+1]);
a=0;
}
/* remove characters which would interfere with the network */
- for (a=0; a<strlen(string); ++a) {
+ for (a=0; !IsEmptyStr(&string[a]); ++a) {
while (string[a]=='!') strcpy(&string[a],&string[a+1]);
while (string[a]=='@') strcpy(&string[a],&string[a+1]);
while (string[a]=='_') strcpy(&string[a],&string[a+1]);
string[a-1]=0;
} while(string[0]=='#');
return(strlen(string));
- }
+}
/*
*/
int pattern2(char *search, char *patn)
{
- int a;
- for (a=0; a<strlen(search); ++a) {
- if (!strncasecmp(&search[a],patn,strlen(patn))) return(a);
+ int a, len;
+
+ len = strlen(patn);
+ for (a=0; !IsEmptyStr(&search[a]); ++a) {
+ if (!strncasecmp(&search[a],patn, len)) return(a);
}
return(-1);
}