libc and csu updates for ELF
This commit is contained in:
parent
d824b54d82
commit
4fe0dfa9aa
@ -54,6 +54,8 @@ extern int etext;
|
|||||||
char **environ;
|
char **environ;
|
||||||
const char *__progname = "";
|
const char *__progname = "";
|
||||||
|
|
||||||
|
char ***_penviron;
|
||||||
|
|
||||||
__dead void _start1(fptr, int, char *[]);
|
__dead void _start1(fptr, int, char *[]);
|
||||||
|
|
||||||
/* The entry function, C part. */
|
/* The entry function, C part. */
|
||||||
@ -63,6 +65,8 @@ _start1(fptr cleanup, int argc, char *argv[])
|
|||||||
char **env;
|
char **env;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
|
_penviron = &environ;
|
||||||
|
|
||||||
env = argv + argc + 1;
|
env = argv + argc + 1;
|
||||||
environ = env;
|
environ = env;
|
||||||
if (argc > 0 && argv[0] != NULL) {
|
if (argc > 0 && argv[0] != NULL) {
|
||||||
|
@ -44,6 +44,28 @@ __RCSID("$NetBSD: getprogname.c,v 1.3 2003/07/26 19:24:42 salo Exp $");
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#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;
|
static const char *theprogname = NULL;
|
||||||
extern const char **__prognamep; /* Copy of argv[]. */
|
extern const char **__prognamep; /* Copy of argv[]. */
|
||||||
extern int __argc; /* Copy of argc. */
|
extern int __argc; /* Copy of argc. */
|
||||||
@ -69,3 +91,4 @@ setprogname(const char *newprogname)
|
|||||||
{
|
{
|
||||||
theprogname = newprogname;
|
theprogname = newprogname;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user