]>
git.saurik.com Git - apple/libc.git/blob - gen/setprogname-fbsd.c
76559d45612b7e1af1fc96678c8d6bdcd51fd90e
2 __FBSDID("$FreeBSD: src/lib/libc/gen/setprogname.c,v 1.8 2002/03/29 22:43:41 markm Exp $");
7 #include <sys/sysctl.h>
8 #include <crt_externs.h>
9 #define __progname (*_NSGetProgname())
11 #include "libc_private.h"
14 setprogname(const char *progname
)
17 char buf
[2*MAXCOMLEN
+1];
20 p
= strrchr(progname
, '/');
22 __progname
= (char *)(p
+ 1);
24 __progname
= (char *)(p
= progname
);
26 strlcpy(&buf
[0], (char *)(p
), sizeof(buf
));
29 mib
[1] = KERN_PROCNAME
;
31 /* ignore errors as this is not a hard error */
32 sysctl(mib
, 2, NULL
, NULL
, &buf
[0], strlen(buf
));