X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fcommands.c;h=7ee8d5d2ddce8dfc16635c4ee5a2d18d74170229;hb=b425dda0a48b4a3e24a9f22d25e864d42679feee;hp=0a2042e3ad1efcc773f8a05a020f48a613c882dd;hpb=8b8941a7c48dfcbec1f356150990da20093d6a16;p=citadel.git diff --git a/citadel/commands.c b/citadel/commands.c index 0a2042e3a..7ee8d5d2d 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -186,7 +186,7 @@ void pprintf(const char *format, ...) { vsnprintf(buf, sizeof(buf), format, arg_ptr); va_end(arg_ptr); - for (i=0; i' || 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]); } } @@ -1048,7 +1051,7 @@ int requires_string(struct citcmd *cptr, int ncomp) 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); } @@ -1579,7 +1582,7 @@ void look_for_ansi(void) } } 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; @@ -1596,7 +1599,7 @@ void keyopt(char *buf) { int i; color(DIM_WHITE); - for (i=0; i') ) { - for (a=0; a