va_args already solved

Florian Lohoff flo at rfc822.org
Sat Jan 11 00:42:02 CET 2003


Hi,
ich probiere um eine va_args funktion einen wrapper zu schreiben -
Sprich - ich will ein exec_bg haben. D.h. soll sich wie exec anfuehlen
aber forken ... d.h. hier die simpleversion zum testen:

void run(char *fmt, ...) {
	va_list va;
	va_start(va, fmt);
	execv(fmt, va);
	/* Not reached */
	va_end();
}

run("programm", "my little exec/fork wrapper", "arg1", "arg2", NULL);

Problem ist jetzt das ich im strace die variablen sehe aber ein shell
script a la

#!/bin/sh
echo $*

gibt nichts aus obwohl $* alle args zeigen sollte ... Ok - mir fiel noch
was ein und schon hats sichs erklaert.

Das erste ARG was uebergeben wird ist "argv[0]" - also der processname
*grunz*

Und damit gehts ...

Flo
-- 
Florian Lohoff                  flo at rfc822.org             +49-5201-669912
                        Heisenberg may have been here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://lug-owl.de/pipermail/linux/attachments/20030111/220e8c79/attachment.sig>


More information about the Linux mailing list