PATCH: replacing exec*p with BB_EXEC*P
Denis Vlasenko
vda.linux at googlemail.com
Sun Feb 4 03:03:28 PST 2007
On Sunday 04 February 2007 11:28, Bernhard Fischer wrote:
> >> #define BB_EXECVP(prog,cmd) execvp(prog,cmd)
> >> -#define BB_EXECLP(prog,cmd,...) execvp(prog,cmd, __VA_ARGS__)
> >> +#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd, __VA_ARGS__)
> >
> >It's probably too messy to make BB_EXECLP a function because of varargs...
>
> Why so? We already have several functions with varargs (our print
> helpers), so this is fine. I'll note that several uncommon compilers had
> problems with __VA_ARGS__ in the preprocessor but work fine for varargs
> for the compiler. I'd prefer to have bb_execlp as a function, too.
I have difficulty imagining how to _implement_ it.
int bb_execlp(char *prog, ...)
{
va_list p;
int n;
va_start(p, prog);
n = vexec(prog, p); ???? libc doesn't have vexec! ???
va_end(p);
return n;
}
Maybe it is doable with dirty tricks like calling execvp
with address of a parameter and hope that on your architecture
it will work.
But it doesn't worth the effort/complexity.
We have only four callsites of execlp.
--
vda
More information about the busybox
mailing list