Path: utzoo!attcan!uunet!usenix!std-unix From: mcgrath%tully.Berkeley.EDU@ucbvax.Berkeley.EDU (Roland McGrath) Newsgroups: comp.std.unix Subject: Re: vexec function(s)? Message-ID: <402@usenix.ORG> Date: 26 Jul 90 00:12:42 GMT References: <10461@cs.utexas.edu> Sender: std-unix@usenix.ORG Reply-To: std-unix@uunet.uu.net Organization: Hackers Anonymous International, Ltd., Inc. (Applications Lines: 43 Approved: jsq@usenix (Moderator, John Quarterman) From: mcgrath%tully.Berkeley.EDU@ucbvax.Berkeley.EDU (Roland McGrath) In article <10461@cs.utexas.edu> rfg@lupine.uucp (Ron Guilmette) writes: 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 b) a standard way to modify one element of a va_list *and* a standard function like: int vexeclp (char *name, va_list vargs); None of these things are a part of standard ANSI C (as far as I know). Are any of them a part of POSIX? If not, why not? A would fall under the C standard, and B under 1003.1. However, neither of these exist. I imagine the answer the appropriate committees would give would be "insufficient utility". At any rate, you can handle the case in question by doing A manually, since `execlp' has a defined way of determining its number of arguments: { char **argv[ARG_MAX]; register unsigned int i = 0; va_list args; va_start(args, lastarg); do argv[i] = va_arg(args, char *); while (argv[i++] != NULL); } (Actually, I would suggest dynamically allocating ARGV to avoid eating all your memory if ARG_MAX is very large.) -- Roland McGrath Free Software Foundation, Inc. roland@ai.mit.edu, uunet!ai.mit.edu!roland Volume-Number: Volume 20, Number 146