2 * Copyright (c) 1990,1991 Regents of the University of Michigan.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of Michigan at Ann Arbor. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
13 char **Argv; /* pointer to original (main's) argv */
14 int Argc; /* original argc */
17 * takes a printf-style format string (fmt) and up to three parameters (a,b,c)
18 * this clobbers the original argv...
22 setproctitle( fmt, a, b, c )
25 static char *endargv = (char *)0;
30 if ( endargv == (char *)0 ) {
31 /* set pointer to end of original argv */
32 endargv = Argv[ Argc-1 ] + strlen( Argv[ Argc-1 ] );
34 sprintf( buf, fmt, a, b, c );
35 /* make ps print "([prog name])" */
39 if ( i > endargv - s - 2 ) {
45 while ( s < endargv ) *s++ = ' ';