#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.
/* VARARGS */
void setproctitle
-#if defined( HAVE_STDARG_H ) && __STDC__
+#if defined( HAVE_STDARG )
( const char *fmt, ... )
#else
- ( fmt, va_alist )
-const char *fmt;
+ ( va_alist )
va_dcl
#endif
{
char buf[ 1024 ];
va_list ap;
-#if defined( HAVE_STDARG_H ) && __STDC__
+#if defined( HAVE_STDARG )
va_start(ap, fmt);
#else
+ const char *fmt;
+
va_start(ap);
+ fmt = va_arg(ap, const char *);
#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);