X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ftools.c;h=98c3bb584a8405d8fe61024223d03bfa6926326b;hb=a8190734b62d75f73e09c8724bef06702fe5a905;hp=ff11a586b332d6d2e4df93bff7c2b2f8848b3d02;hpb=edf4e47071ad36ace78fc93321c84adb6ce0309c;p=citadel.git diff --git a/webcit/tools.c b/webcit/tools.c index ff11a586b..98c3bb584 100644 --- a/webcit/tools.c +++ b/webcit/tools.c @@ -249,12 +249,19 @@ int pattern2(char *search, char *patn) */ void striplt(char *buf) { - if (strlen(buf) == 0) return; - while ((strlen(buf) > 0) && (isspace(buf[0]))) - strcpy(buf, &buf[1]); - if (strlen(buf) == 0) return; - while (isspace(buf[strlen(buf) - 1])) - buf[strlen(buf) - 1] = 0; + long len; + + len = strlen(buf); + if (len == 0) return; + while ((len > 0) && (isspace(buf[0]))){ + memmove (buf, &buf[1], len); + len --; + } + if (len == 0) return; + while (isspace(buf[len - 1])){ + buf[len - 1] = 0; + len --; + } }