aboutsummaryrefslogtreecommitdiff
path: root/lib/csu
diff options
context:
space:
mode:
authorNate Williams <nate@FreeBSD.org>1993-06-29 04:34:12 +0000
committerNate Williams <nate@FreeBSD.org>1993-06-29 04:34:12 +0000
commit25a0fedd258a4c42a59b8804f9d2e2ab669a7a9d (patch)
tree56da4d1d50541bbed04ccf64d6f6155bf2a8ef84 /lib/csu
parent967cd26f61253c4030310cf60bf01fb350dfe628 (diff)
downloadsrc-25a0fedd258a4c42a59b8804f9d2e2ab669a7a9d.tar.gz
src-25a0fedd258a4c42a59b8804f9d2e2ab669a7a9d.zip
Added some support the new err(3) routines need
(Copied directly from NetBSD verbatim)
Notes
Notes: svn path=/head/; revision=52
Diffstat (limited to 'lib/csu')
-rw-r--r--lib/csu/i386/crt0.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/csu/i386/crt0.c b/lib/csu/i386/crt0.c
index e25eba5b0f48..7c3cef10e6d6 100644
--- a/lib/csu/i386/crt0.c
+++ b/lib/csu/i386/crt0.c
@@ -45,7 +45,13 @@ static char sccsid[] = "@(#)crt0.c 5.7 (Berkeley) 7/3/91";
* ebp, which points to the base of the kernel calling frame.
*/
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
char **environ = (char **)0;
+static char empty[1];
+char *__progname = empty;
int errno = 0;
asm(".text");
@@ -95,6 +101,12 @@ asm("eprol:");
atexit(_mcleanup);
monstartup(&eprol, &etext);
#endif MCRT0
+ errno = 0;
+ if (argv[0])
+ if ((__progname = strrchr(argv[0], '/')) == NULL)
+ __progname = argv[0];
+ else
+ ++__progname;
exit(main(kfp->kargc, argv, environ));
}