Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!jbc From: rfg@lupine.uucp (Ron Guilmette) Newsgroups: comp.std.unix Subject: vexec function(s)? Message-ID: <10461@cs.utexas.edu> Date: 23 Jul 90 23:20:32 GMT Sender: jbc@cs.utexas.edu Reply-To: lupine!rfg@uunet.UU.NET Organization: Network Computing Devices, Inc., Mt. View, CA Lines: 50 Approved: jbc@cs.utexas.edu (Guest Moderator, John B. Chambers) From: rfg@lupine.uucp (Ron Guilmette) Just a trivia question. On very rare occasions, I have found the family of vprintf functions (i.e. vprintf, vfprintf, and vsprintf) quite useful. In certain cases, there is simply no other way to accomplish quite the same thing (especially on the newer RISC machines where methods of passing variable numbers of parameters can get rather complicated). Now I'm looking at a hunk of non-portable code (written by somebody else of course :-) that I have to port. and this code involves a call to execvp. It looks kinda like: ------------------------------------------------------------------------------ different_execvp (a, args) char *a; va_list args; { char **argv; argv = (char **) args; /* YIKES!!! */ argv[0] = basename(argv[0]); execvp(a, argv); } ------------------------------------------------------------------------------ The line with the comment /* YIKES!!! */ gets errors during compilation due to a severe type mishmash for the assignment. That's due to the fact that (on the machine I am compiling on, the type used for `va_list' is most definitely *not* a type which can be legally typecast to a pointer. (Hint: it is a struct on this type of RISC machine.) 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? Volume-Number: Volume 20, Number 138