]> andersk Git - moira.git/blobdiff - server/mr_util.c
Oracle and Solaris/POSIX changes
[moira.git] / server / mr_util.c
index 9926446eb854d43c503a02da2c77089c04d1b95a..3ff7b674b2cb632b868ec1de10840dfe1a085304 100644 (file)
@@ -16,8 +16,8 @@ static char *rcsid_mr_util_c = "$Header$";
 #include "mr_server.h"
 
 #include <ctype.h>
-#include <strings.h>
 #include <sys/types.h>
+#include <string.h>
 
 extern char *whoami;
 
@@ -30,26 +30,21 @@ requote(buf, cp, len)
        register unsigned char c;
        if (len <= 2) return buf;
        *buf++ = '"'; count++; len--;
-       for(; (count < 40) && (len > 1) && (c = *cp);
+       for(; (count < 258) && (len > 1) && (c = *cp);
            cp++, --len, ++count) {
                if (c == '\\' || c == '"') *buf++ = '\\';
                if (isprint(c)) *buf++ = c;
                else {
                        sprintf(buf, "\\%03o", c);
-                       buf = index(buf, '\0');
+                       buf = strchr(buf, '\0');
                }
        }
        if (len > 1) { *buf++ = '"'; count++; len--; }
-       if (len > 3 && count >= 40) {
-               *buf++ = '.'; count++; len--;
-               *buf++ = '.'; count++; len--;
-               *buf++ = '.'; count++; len--;
-       }
        if (len > 1) *buf = '\0';
        return buf;
 }
 
-log_args(tag, version, argc, argv)
+void log_args(tag, version, argc, argv)
        char *tag;
        int version;
        int argc;
@@ -63,12 +58,12 @@ log_args(tag, version, argc, argv)
        sprintf(buf, "%s[%d]: ", tag, version);
        for (bp = buf; *bp; bp++);
        
-       for (i = 0; i < argc && ((buf - bp) + 1024) > 2; i++) {
+       for (i = 0; i < argc && ((buf - bp) + BUFSIZ) > 2; i++) {
                if (i != 0) {
                        *bp++ = ',';
                        *bp++ = ' '; 
                }
-               bp = requote(bp, argv[i], (buf - bp) + 1024);
+               bp = requote(bp, argv[i], (buf - bp) + BUFSIZ);
        }
        *bp = '\0';
        com_err(whoami, 0, "%s", buf);
This page took 0.033715 seconds and 4 git commands to generate.