From: Arun Thomas Date: Fri, 10 Dec 2010 23:04:04 +0000 (+0000) Subject: libc and csu updates for ELF X-Git-Tag: v3.2.0~716 X-Git-Url: http://zhaoyanbai.com/repos//%22http:/%22%29?a=commitdiff_plain;h=4fe0dfa9aa10417278752851163e211f7f767f9f;p=minix.git libc and csu updates for ELF --- diff --git a/lib/csu/i386-elf/crt1_c.c b/lib/csu/i386-elf/crt1_c.c index 25dc5acb1..f60e8b64f 100644 --- a/lib/csu/i386-elf/crt1_c.c +++ b/lib/csu/i386-elf/crt1_c.c @@ -54,6 +54,8 @@ extern int etext; char **environ; const char *__progname = ""; +char ***_penviron; + __dead void _start1(fptr, int, char *[]); /* The entry function, C part. */ @@ -63,6 +65,8 @@ _start1(fptr cleanup, int argc, char *argv[]) char **env; const char *s; + _penviron = &environ; + env = argv + argc + 1; environ = env; if (argc > 0 && argv[0] != NULL) { diff --git a/lib/libc/other/getprogname.c b/lib/libc/other/getprogname.c index 102642547..78fc96aae 100644 --- a/lib/libc/other/getprogname.c +++ b/lib/libc/other/getprogname.c @@ -44,6 +44,28 @@ __RCSID("$NetBSD: getprogname.c,v 1.3 2003/07/26 19:24:42 salo Exp $"); #include #include +#if defined(__ELF__) +extern const char *__progname; + +const char * +getprogname(void) +{ + + return (__progname); +} + +void +setprogname(const char *progname) +{ + const char *p; + + p = strrchr(progname, '/'); + if (p != NULL) + __progname = p + 1; + else + __progname = progname; +} +#else static const char *theprogname = NULL; extern const char **__prognamep; /* Copy of argv[]. */ extern int __argc; /* Copy of argc. */ @@ -69,3 +91,4 @@ setprogname(const char *newprogname) { theprogname = newprogname; } +#endif