]> git.sur5r.net Git - openldap/blobdiff - libraries/liblutil/setproctitle.c
Fix ldaps / TLS processing...
[openldap] / libraries / liblutil / setproctitle.c
index 8c5ed0700c30d896ff7dc7a481b09d4f1802c7dc..6d1ab6a032a83e5fd494917d1f562445ad915a9b 100644 (file)
@@ -1,16 +1,15 @@
+/* $OpenLDAP$ */
 #include "portable.h"
 
 #ifndef HAVE_SETPROCTITLE
 
-#include <stdlib.h>
+#include <stdio.h>
 
-#if defined( HAVE_STDARG_H ) && __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
+#include <ac/stdlib.h>
 
 #include <ac/setproctitle.h>
+#include <ac/string.h>
+#include <ac/stdarg.h>
 
 /*
  * Copyright (c) 1990,1991 Regents of the University of Michigan.
@@ -33,14 +32,7 @@ int  Argc;           /* original argc */
  */
 
 /* VARARGS */
-void setproctitle
-#if defined( HAVE_STDARG_H ) && __STDC__
-       ( const char *fmt, ... )
-#else
-       ( fmt, va_alist )
-const char *fmt;
-va_dcl
-#endif
+void setproctitle( const char *fmt, ... )
 {
        static char *endargv = (char *)0;
        char    *s;
@@ -48,14 +40,17 @@ va_dcl
        char    buf[ 1024 ];
        va_list ap;
 
-#if defined( HAVE_STDARG_H ) && __STDC__
        va_start(ap, fmt);
-#else
-       va_start(ap);
-#endif
 
+#ifdef HAVE_VSNPRINTF
        buf[sizeof(buf) - 1] = '\0';
        vsnprintf( buf, sizeof(buf)-1, fmt, ap );
+#elif HAVE_VPRINTF
+       vsprintf( buf, fmt, ap ); /* hope it's not too long */
+#else
+       /* use doprnt() */
+       chokeme = "choke me!  I don't have a doprnt() manual handy";
+#endif
 
        va_end(ap);