/* $Cambridge: hermes/src/prayer/lib/setproctitle.h,v 1.3 2008/09/16 09:59:57 dpc22 Exp $ */
/************************************************
 *    Prayer - a Webmail Interface              *
 ************************************************/

/* Copyright (c) University of Cambridge 2000 - 2008 */
/* See the file NOTICE for conditions of use and distribution. */

#include <sys/param.h>

#ifdef __linux__
# define SPT_TYPE	SPT_REUSEARGV
# define SPT_PADCHAR	'\0'    /* pad process title with nulls */
#elif (defined(BSD) && BSD >= 199306)
# define SPT_TYPE	SPT_BUILTIN
#else
#define SPT_TYPE        SPT_NONE
#endif

/* Following code has been stolen from sendmail 8.9.3: src/conf.[ch] */

#define MAXLINE	2048            /* max line length */
#define SPACELEFT(buf, ptr)  (sizeof buf - ((ptr) - buf))

# ifdef __STDC__

# include <stdarg.h>

# define VA_LOCAL_DECL	va_list ap;
# define VA_START(f)	va_start(ap, f)
# define VA_END		va_end(ap)

# else

# include <varargs.h>

# define VA_LOCAL_DECL	va_list ap;
# define VA_START(f)	va_start(ap)
# define VA_END		va_end(ap)

# endif

void initsetproctitle(const char *name, int argc, char **argv,
                      char **envp);
void setproctitle(const char *fmt, ...);
