X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fsupport.c;h=16e10e6f8e38f25ca4ba5583bdd83393f0ccc61d;hb=489820aa544023dba04463b8474a22ff78ced029;hp=2ff3ba7fbc45b9e3342d51769f7a267d8549c572;hpb=2fe2098b829651c53c6880e6e6489ace09ba1b9e;p=citadel.git diff --git a/citadel/support.c b/citadel/support.c index 2ff3ba7fb..16e10e6f8 100644 --- a/citadel/support.c +++ b/citadel/support.c @@ -1,56 +1,62 @@ -/* $Id$ */ -#include -#include -#include +/* + * Server-side utility functions + */ + +#include "sysdep.h" #include #include -#include +#include +#include + #include "citadel.h" -#include "server.h" #include "support.h" - /* * strproc() - make a string 'nice' */ void strproc(char *string) { - int a; + int a, b; - if (strlen(string)==0) return; + if (string == NULL) return; + if (IsEmptyStr(string)) return; /* Convert non-printable characters to blanks */ - for (a=0; a126) string[a]=32; - } + } + /* a is now the length of our string. */ /* Remove leading and trailing blanks */ - while( (string[0]<33) && (strlen(string)>0) ) - strcpy(string,&string[1]); - while( (string[strlen(string)-1]<33) && (strlen(string)>0) ) - string[strlen(string)-1]=0; + while( (string[a-1]<33) && (!IsEmptyStr(string)) ) + string[--a]=0; + b = 0; + while( (string[b]<33) && (!IsEmptyStr(&string[b])) ) + b++; + if (b > 0) + memmove(string,&string[b], a - b + 1); /* Remove double blanks */ - for (a=0; a