$darkmode
Elektra 0.11.0
|
Contract constructors for kdbOpen() More...
Functions | |
int | elektraGOptsContract (KeySet *contract, int argc, const char *const *argv, const char *const *envp, const Key *parentKey, KeySet *goptsConfig) |
Sets up a contract for use with kdbOpen() that configures the gopts plugin. More... | |
int | elektraGOptsContractFromStrings (KeySet *contract, size_t argsSize, const char *args, size_t envSize, const char *env, const Key *parentKey, KeySet *goptsConfig) |
Sets up a contract for use with kdbOpen() that configures the gopts plugin. More... | |
Contract constructors for kdbOpen()
int elektraGOptsContract | ( | KeySet * | contract, |
int | argc, | ||
const char *const * | argv, | ||
const char *const * | envp, | ||
const Key * | parentKey, | ||
KeySet * | goptsConfig | ||
) |
Sets up a contract for use with kdbOpen() that configures the gopts plugin.
You can pass 0 for argc
and NULL
for argv
to let gopts lookup command line options internally. You can also pass NULL
for envp
to do the same for environment variables.
contract | The KeySet into which the contract will be written. |
argc | The argc value that should be used by gopts. |
argv | The argv value that should be used by gopts. IMPORTANT: The pointer and data behind must be valid until after kdbClose() is called. |
envp | The envp value that should be used by gopts. IMPORTANT: The pointer and data behind must be valid until after kdbClose() is called. |
parentKey | The parent key that should be used by gopts. Only the key name is copied. The key can be deleted immediately after calling this function. |
goptsConfig | The config that used to mount the gopts plugin. This value can be NULL. Only keys in the user:/ namespace will be used. |
-1 | if contract or parentKey is NULL |
-1 | if argc is 0 and argv is not NULL or if argc is not 0 and argv is NULL |
0 | on success |
int elektraGOptsContractFromStrings | ( | KeySet * | contract, |
size_t | argsSize, | ||
const char * | args, | ||
size_t | envSize, | ||
const char * | env, | ||
const Key * | parentKey, | ||
KeySet * | goptsConfig | ||
) |
Sets up a contract for use with kdbOpen() that configures the gopts plugin.
NOTE: prefer to use elektraGOptsContract() if possible
You can pass NULL
for args
to let gopts lookup command line options internally. You can also pass NULL
for env
to do the same for environment variables.
contract | The KeySet into which the contract will be written. |
argsSize | The size of the args data |
args | Continuous buffer containing all argv arguments separated (and terminated) by zero bytes. The whole buffer is copied, so the pointer only has to be valid for this function call. |
envSize | The size of the env data |
env | Continuous buffer containing all environment variables separated (and terminated) by zero bytes The whole buffer is copied, so the pointer only has to be valid for this function call. |
parentKey | The parent key that should be used by gopts. Only the key name is copied. The key can be deleted immediately after calling this function. |
goptsConfig | The config that used to mount the gopts plugin. This value can be NULL. Only keys in the user:/ namespace will be used. |
-1 | if any of contract or parentKey is NULL |
0 | on success |