Read 'main()' function arguments from config file

This patch reads program arguments from the config file and makes them
available to the application via the 'argc' and 'argv' arguments of the
'main()' function. The configuration syntax looks like this:

<config>
	<arg value="...">
	<arg value="...">
        ...
</config>

The 'value' attribute of the first <arg> node becomes 'argv[0]' and so on.

Fixes #184.
This commit is contained in:
Christian Prochaska
2012-04-18 17:45:03 +02:00
committed by Norman Feske
parent afe996df74
commit de92956220
6 changed files with 168 additions and 0 deletions

View File

@ -48,6 +48,16 @@ __attribute__((constructor(101))) void lx_hybrid_init()
lx_environ = environ;
}
/*
* Dummy symbols to let generic tests programs (i.e., 'test-config_args') link
* successfully. Please note that such programs are not expected to work when
* built as hybrid Linux/Genode programs because when using the glibc startup
* code, we cannot manipulate argv prior executing main. However, by defining
* these symbols, we prevent the automated build bot from stumbling over such
* binaries.
*/
char **genode_argv = 0;
int genode_argc = 1;
/************
** Thread **