When checking to see whether we have to rebind a new key and/or
[citadel.git] / citadel / support.c
index d3ffa929ee525530d4c9a710781981fdadbf8e04..20937f2b82305ad936c77e7722aac73639457631 100644 (file)
@@ -1,38 +1,29 @@
-/*
- * Server-side utility functions
- */
+// Server-side utility functions
 
 #include "sysdep.h"
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <ctype.h>
 #include <stdio.h>
 #include <string.h>
+#include <sys/stat.h>
 #include <libcitadel.h>
+
 #include "citadel.h"
-#include "server.h"
 #include "support.h"
 
-/*
- * strproc()  -  make a string 'nice'
- */
-void strproc(char *string)
-{
+// strproc()  -  make a string 'nice'
+void strproc(char *string) {
        int a, b;
 
        if (string == NULL) return;
        if (IsEmptyStr(string)) return;
 
-       /* Convert non-printable characters to blanks */
+       // 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;
        }
 
-       /* a is now the length of our string. */
-       /* Remove leading and trailing blanks */
+       // a is now the length of our string.
+       // Remove leading and trailing blanks
        while( (string[a-1]<33) && (!IsEmptyStr(string)) )
                string[--a]=0;
        b = 0;
@@ -41,7 +32,7 @@ void strproc(char *string)
        if (b > 0)
                memmove(string,&string[b], a - b + 1);
 
-       /* Remove double blanks */
+       // Remove double blanks
        for (a=0; !IsEmptyStr(&string[a]); ++a) {
                if ((string[a]==32)&&(string[a+1]==32)) {
                        strcpy(&string[a],&string[a+1]);
@@ -49,7 +40,7 @@ void strproc(char *string)
                }
        }
 
-       /* remove characters which would interfere with the network */
+       // 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]);
@@ -62,13 +53,9 @@ void strproc(char *string)
 }
 
 
-
-/*
- * get a line of text from a file
- * ignores lines starting with #
- */
-int getstring(FILE *fp, char *string)
-{
+// get a line of text from a file
+// ignores lines starting with #
+int getstring(FILE *fp, char *string) {
        int a,c;
        do {
                strcpy(string,"");
@@ -85,41 +72,3 @@ int getstring(FILE *fp, char *string)
                } while(string[0]=='#');
        return(strlen(string));
 }
-
-
-
-
-/*
- * 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<numdirs; ++a) {
-               snprintf(buf, sizeof buf, "%s/%s", dirs[a], searchfor);
-               if (!stat(buf, &test)) {
-                       snprintf(targ, n, "%s/%s", dirs[a], searchfor);
-                       return;
-               }
-       }
-       strcpy(targ,"");
-}
-
-
-#ifndef HAVE_STRERROR
-/*
- * replacement strerror() for systems that don't have it
- */
-char *strerror(int e)
-{
-       static char buf[32];
-
-       snprintf(buf,sizeof buf,"errno = %d",e);
-       return(buf);
-       }
-#endif
-