3 #ifndef HAVE_SETPROCTITLE
9 #include <ac/setproctitle.h>
10 #include <ac/string.h>
11 #include <ac/stdarg.h>
14 * Copyright (c) 1990,1991 Regents of the University of Michigan.
15 * All rights reserved.
17 * Redistribution and use in source and binary forms are permitted
18 * provided that this notice is preserved and that due credit is given
19 * to the University of Michigan at Ann Arbor. The name of the University
20 * may not be used to endorse or promote products derived from this
21 * software without specific prior written permission. This software
22 * is provided ``as is'' without express or implied warranty.
25 char **Argv; /* pointer to original (main's) argv */
26 int Argc; /* original argc */
29 * takes a printf-style format string (fmt) and up to three parameters (a,b,c)
30 * this clobbers the original argv...
35 #if defined( HAVE_STDARG )
36 ( const char *fmt, ... )
42 static char *endargv = (char *)0;
48 #if defined( HAVE_STDARG )
54 fmt = va_arg(ap, const char *);
58 buf[sizeof(buf) - 1] = '\0';
59 vsnprintf( buf, sizeof(buf)-1, fmt, ap );
61 vsprintf( buf, fmt, ap ); /* hope it's not too long */
64 chokeme = "choke me! I don't have a doprnt() manual handy";
69 if ( endargv == (char *)0 ) {
70 /* set pointer to end of original argv */
71 endargv = Argv[ Argc-1 ] + strlen( Argv[ Argc-1 ] );
73 /* make ps print "([prog name])" */
77 if ( i > endargv - s - 2 ) {
83 while ( s < endargv ) *s++ = ' ';
85 #endif /* NOSETPROCTITLE */