Calculate environ directly from argc and argv, rather than searcing down

the argument list.
This commit is contained in:
mycroft 1995-05-16 16:25:04 +00:00
parent 85dbf66a28
commit 3ad209c804
3 changed files with 10 additions and 22 deletions

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: crt0.c,v 1.16 1995/01/17 06:09:43 mycroft Exp $
* $Id: crt0.c,v 1.17 1995/05/16 16:25:19 mycroft Exp $
*/
@ -123,7 +123,6 @@ start()
* ALL REGISTER VARIABLES!!!
*/
register struct kframe *kfp;
register char **targv;
register char **argv;
extern void _mcleanup();
#ifdef DYNAMIC
@ -137,11 +136,8 @@ start()
/* just above the saved frame pointer */
asm ("lea 4(%%ebp), %0" : "=r" (kfp) );
#endif /* not lint */
for (argv = targv = &kfp->kargv[0]; *targv++; /* void */)
/* void */ ;
if (targv >= (char **)(*argv))
--targv;
environ = targv;
argv = &kfp->kargv[0];
environ = argv + kfp->kargc + 1;
if (argv[0])
if ((__progname = _strrchr(argv[0], '/')) == NULL)

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: crt0.c,v 1.10 1995/01/17 06:10:31 mycroft Exp $
* $Id: crt0.c,v 1.11 1995/05/16 16:25:04 mycroft Exp $
*/
@ -123,7 +123,6 @@ start()
* ALL REGISTER VARIABLES!!!
*/
register struct kframe *kfp;
register char **targv;
register char **argv;
extern void _mcleanup();
#ifdef DYNAMIC
@ -136,11 +135,8 @@ start()
#else /* not lint */
asm("lea a6@(4),%0" : "=r" (kfp)); /* catch it quick */
#endif /* not lint */
for (argv = targv = &kfp->kargv[0]; *targv++; /* void */)
/* void */ ;
if (targv >= (char **)(*argv))
--targv;
environ = targv;
argv = &kfp->kargv[0];
environ = argv + kfp->kargc + 1;
if (argv[0])
if ((__progname = _strrchr(argv[0], '/')) == NULL)

View File

@ -27,12 +27,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: crt0.c,v 1.3 1994/06/09 05:50:34 phil Exp $
* $Id: crt0.c,v 1.4 1995/05/16 16:32:14 mycroft Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char sccsid[] = "@(#)crt0.c 5.7 (Berkeley) 7/3/91"; */
static char rcsid[] = "$Id: crt0.c,v 1.3 1994/06/09 05:50:34 phil Exp $";
static char rcsid[] = "$Id: crt0.c,v 1.4 1995/05/16 16:32:14 mycroft Exp $";
#endif /* LIBC_SCCS and not lint */
extern void exit();
@ -125,7 +125,6 @@ start(long param)
* ALL REGISTER VARIABLES!!!
*/
register struct kframe *kfp;
register char **targv;
register char **argv;
extern void _mcleanup();
#ifdef DYNAMIC
@ -134,11 +133,8 @@ start(long param)
/* just above the saved frame pointer */
kfp = (struct kframe *) (&param-1);
for (argv = targv = &kfp->kargv[0]; *targv++; /* void */)
/* void */ ;
if (targv >= (char **)(*argv))
--targv;
environ = targv;
argv = &kfp->kargv[0];
environ = argv + kfp->kargc + 1;
if (argv[0])
if ((__progname = _strrchr(argv[0], '/')) == NULL)