X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fsupport.c;h=af155d31df92298178ab5e9c03a742be304fa133;hb=HEAD;hp=a3ebffc19142e7bb6d52288160b0011f25df099d;hpb=b425dda0a48b4a3e24a9f22d25e864d42679feee;p=citadel.git diff --git a/citadel/support.c b/citadel/support.c deleted file mode 100644 index a3ebffc19..000000000 --- a/citadel/support.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * $Id$ - * - * Server-side utility functions - * - */ - -#include "sysdep.h" -#include -#include -#include -#include -#include -#include -#include -#include "citadel.h" -#include "server.h" -#include "support.h" -#include "tools.h" - -/* - * strproc() - make a string 'nice' - */ -void strproc(char *string) -{ - int a; - - if (string == NULL) return; - if (IsEmptyStr(string)) return; - - /* Convert non-printable characters to blanks */ - for (a=0; !IsEmptyStr(&string[a]); ++a) { - if (string[a]<32) string[a]=32; - if (string[a]>126) string[a]=32; - } - - /* Remove leading and trailing blanks */ - while( (string[0]<33) && (!IsEmptyStr(string)) ) - strcpy(string,&string[1]); - while( (string[strlen(string)-1]<33) && (!IsEmptyStr(string)) ) - string[strlen(string)-1]=0; - - /* Remove double blanks */ - 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; !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]); - 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]); - } - -} - - - -/* - * get a line of text from a file - * ignores lines starting with # - */ -int getstring(FILE *fp, char *string) -{ - int a,c; - do { - strcpy(string,""); - a=0; - do { - c=getc(fp); - if (c<0) { - string[a]=0; - return(-1); - } - string[a++]=c; - } while(c!=10); - string[a-1]=0; - } while(string[0]=='#'); - return(strlen(string)); -} - - -/* - * pattern2() - searches for patn within search string, returns pos - */ -int pattern2(char *search, char *patn) -{ - int a, len; - - len = strlen(patn); - for (a=0; !IsEmptyStr(&search[a]); ++a) { - if (!strncasecmp(&search[a],patn, len)) return(a); - } - return(-1); - } - - -/* - * mesg_locate() - locate a message or help file, case insensitive - */ -void mesg_locate(char *targ, size_t n, const char *searchfor, - int numdirs, const char * const *dirs) -{ - int a; - char buf[SIZ]; - struct stat test; - - for (a=0; a