Example of passing arguments at process startup
Below is the code of the Env
program. When the process named NetVfs
starts, the program passes three arguments to this process: NetVfs
, -l devfs /dev devfs 0
and -l romfs /etc romfs 0
:
env.c
#include <env/env.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
const char* NetVfsArgs[] = {
"-l", "devfs /dev devfs 0",
"-l", "romfs /etc romfs 0"
};
ENV_REGISTER_ARGS("NetVfs", NetVfsArgs);
envServerRun();
return EXIT_SUCCESS;
}
Example of passing environment variables at process startup
Below is the code of the Env
program. When the process named Vfs3
starts, the program passes two environment variables to this process: ROOTFS=ramdisk0,0 / ext2 0
and UNMAP_ROMFS=1
:
env.c
#include <env/env.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
const char* Vfs3Envs[] = {
"ROOTFS=ramdisk0,0 / ext2 0",
"UNMAP_ROMFS=1"
};
ENV_REGISTER_VARS("Vfs3", Vfs3Envs);
envServerRun();
return EXIT_SUCCESS;
}
Page top