14 * strproc() - make a string 'nice'
16 void strproc(char *string)
20 if (strlen(string)==0) return;
22 /* Convert non-printable characters to blanks */
23 for (a=0; a<strlen(string); ++a) {
24 if (string[a]<32) string[a]=32;
25 if (string[a]>126) string[a]=32;
28 /* Remove leading and trailing blanks */
29 while( (string[0]<33) && (strlen(string)>0) )
30 strcpy(string,&string[1]);
31 while( (string[strlen(string)-1]<33) && (strlen(string)>0) )
32 string[strlen(string)-1]=0;
34 /* Remove double blanks */
35 for (a=0; a<strlen(string); ++a) {
36 if ((string[a]==32)&&(string[a+1]==32)) {
37 strcpy(&string[a],&string[a+1]);
42 /* remove characters which would interfere with the network */
43 for (a=0; a<strlen(string); ++a) {
44 while (string[a]=='!') strcpy(&string[a],&string[a+1]);
45 while (string[a]=='@') strcpy(&string[a],&string[a+1]);
46 while (string[a]=='_') strcpy(&string[a],&string[a+1]);
47 while (string[a]==',') strcpy(&string[a],&string[a+1]);
48 while (string[a]=='%') strcpy(&string[a],&string[a+1]);
49 while (string[a]=='|') strcpy(&string[a],&string[a+1]);
57 * get a line of text from a file
58 * ignores lines starting with #
60 int getstring(FILE *fp, char *string)
75 } while(string[0]=='#');
76 return(strlen(string));
81 * pattern2() - searches for patn within search string, returns pos
83 int pattern2(char *search, char *patn)
86 for (a=0; a<strlen(search); ++a) {
87 if (!strncasecmp(&search[a],patn,strlen(patn))) return(a);
94 * mesg_locate() - locate a message or help file, case insensitive
96 void mesg_locate(char *targ, char *searchfor, int numdirs, char **dirs)
102 for (a=0; a<numdirs; ++a) {
103 sprintf(buf,"cd %s; exec ls",dirs[a]);
104 ls = (FILE *) popen(buf,"r");
106 while(fgets(buf,255,ls)!=NULL) {
107 while (isspace(buf[strlen(buf)-1]))
108 buf[strlen(buf)-1] = 0;
109 if (!strcasecmp(buf,searchfor)) {
111 sprintf(targ,"%s/%s",dirs[a],buf);
122 #ifndef HAVE_STRERROR
124 * replacement strerror() for systems that don't have it
126 char *strerror(int e)
130 sprintf(buf,"errno = %d",e);