🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.unix
Article #397

Re: vexec function(s)?

#397
From: Guy Harris
Date: Wed, 25 Jul 1990 18:24
33 lines
1553 bytes
From:  guy@auspex.uucp (Guy Harris)

>What I appear to need here is either:
>
>	a)  a standard way to convert a va_list into a list of pointers
>	    (to argument values), or

I suspect "different_execvp" is misnamed; given the "va_list", it
appears to have a calling sequence more like "execlp" - i.e.,

	different_execlp("/bin/explode", "explode", "bright blue light",
	    (char *)NULL);

Given that, you could scan the argument list twice; the first time,
you'd count the number of arguments, then you'd malloc up an array of
N+1 "char *"s, and scan the argument list a second time filling in that
array.  Now "argv" is a pointer to the first element of that array....

>None of these things are a part of standard ANSI C (as far as I know).

The second isn't; the first can be done in ANSI C, unless I've missed
something subtle in the spec that forbids traversing the argument list
twice (I just checked and didn't see anything obvious).

>Are any of them a part of POSIX?

Nope.

>If not, why not?

Because the first can be done in ANSI C (or pre-ANSI C with <varargs.h>).

Volume-Number: Volume 20, Number 145
Technical Details
Message-ID: <401@usenix.ORG>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!usenix!std-unix
References: <10461@cs.utexas.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!usenix!std-unix
From: guy@auspex.uucp (Guy Harris)
Newsgroups: comp.std.unix
Subject: Re: vexec function(s)?
Message-ID: <401@usenix.ORG>
Date: 25 Jul 90 18:24:00 GMT
References: <10461@cs.utexas.edu>
Sender: std-unix@usenix.ORG
Reply-To: std-unix@uunet.uu.net
Organization: Auspex Systems, Santa Clara
Lines: 33
Approved: jsq@usenix (Moderator, John Quarterman)