1 --- setprogname.c.orig 2005-10-19 15:16:49.000000000 -0700
2 +++ setprogname.c 2005-10-19 15:17:10.000000000 -0700
7 +#include <sys/param.h>
8 +#include <sys/sysctl.h>
9 +#include <crt_externs.h>
10 +#define __progname (*_NSGetProgname())
12 #include "libc_private.h"
15 setprogname(const char *progname)
19 + char buf[2*MAXCOMLEN+1];
22 p = strrchr(progname, '/');
25 + __progname = (char *)(p + 1);
27 - __progname = progname;
28 + __progname = (char *)(p = progname);
30 + strlcpy(&buf[0], (char *)(p), sizeof(buf));
33 + mib[1] = KERN_PROCNAME;
35 + /* ignore errors as this is not a hard error */
36 + sysctl(mib, 2, NULL, NULL, &buf[0], 2*MAXCOMLEN);