]> code.citadel.org Git - citadel.git/blobdiff - citadel/support.c
- port to Cygwin (DLL support, etc.)
[citadel.git] / citadel / support.c
index cc4ac677b38d87577225bc4ce960296dda3b6bae..3262890b2cabec271475df30acbd6b45a5c5b1e5 100644 (file)
@@ -1,4 +1,14 @@
-/* $Id$ */
+/*
+ * $Id$
+ *
+ * Server-side utility functions
+ *
+ */
+
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -17,6 +27,7 @@ void strproc(char *string)
 {
        int a;
 
+       if (string == NULL) return;
        if (strlen(string)==0) return;
 
        /* Convert non-printable characters to blanks */
@@ -96,14 +107,14 @@ int pattern2(char *search, char *patn)
 void mesg_locate(char *targ, char *searchfor, int numdirs, char **dirs)
 {
        int a;
-       char buf[256];
+       char buf[SIZ];
        FILE *ls;
 
        for (a=0; a<numdirs; ++a) {
                sprintf(buf,"cd %s; exec ls",dirs[a]);
                ls = (FILE *) popen(buf,"r");
                if (ls != NULL) {
-                       while(fgets(buf,255,ls)!=NULL) {
+                       while(fgets(buf,sizeof buf,ls)!=NULL) {
                                while (isspace(buf[strlen(buf)-1]))
                                        buf[strlen(buf)-1] = 0;
                                if (!strcasecmp(buf,searchfor)) {