.TH "kdbgopts.h" 3elektra "Fri Aug 4 2023" "Version 0.11.0" "Elektra" \" -*- nroff -*-
.ad l
.nh
.SH NAME
kdbgopts.h \- Gopts contract\&.  

.SH SYNOPSIS
.br
.PP
\fC#include <kdb\&.h>\fP
.br

.SS "Functions"

.in +1c
.ti -1c
.RI "int \fBelektraGOptsContract\fP (KeySet *contract, int argc, const char *const *argv, const char *const *envp, const Key *parentKey, KeySet *goptsConfig)"
.br
.RI "Sets up a contract for use with \fBkdbOpen()\fP that configures the gopts plugin\&. "
.ti -1c
.RI "int \fBelektraGOptsContractFromStrings\fP (KeySet *contract, size_t argsSize, const char *args, size_t envSize, const char *env, const Key *parentKey, KeySet *goptsConfig)"
.br
.RI "Sets up a contract for use with \fBkdbOpen()\fP that configures the gopts plugin\&. "
.in -1c
.SH "Detailed Description"
.PP 
Gopts contract\&. 


.PP
\fBCopyright\fP
.RS 4
BSD License (see LICENSE\&.md or https://www.libelektra.org) 
.RE
.PP

.SH "Function Documentation"
.PP 
.SS "int elektraGOptsContract (KeySet * contract, int argc, const char *const * argv, const char *const * envp, const Key * parentKey, KeySet * goptsConfig)"

.PP
Sets up a contract for use with \fBkdbOpen()\fP that configures the gopts plugin\&. You can pass 0 for \fCargc\fP \fBand\fP \fCNULL\fP for \fCargv\fP to let gopts lookup command line options internally\&. You can also pass \fCNULL\fP for \fCenvp\fP to do the same for environment variables\&.
.PP
\fBParameters\fP
.RS 4
\fIcontract\fP The KeySet into which the contract will be written\&. 
.br
\fIargc\fP The argc value that should be used by gopts\&. 
.br
\fIargv\fP The argv value that should be used by gopts\&. IMPORTANT: The pointer and data behind must be valid until after \fBkdbClose()\fP is called\&. 
.br
\fIenvp\fP The envp value that should be used by gopts\&. IMPORTANT: The pointer and data behind must be valid until after \fBkdbClose()\fP is called\&. 
.br
\fIparentKey\fP 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\&. 
.br
\fIgoptsConfig\fP The config that used to mount the gopts plugin\&. This value can be NULL\&. Only keys in the user:/ namespace will be used\&.
.RE
.PP
\fBReturn values\fP
.RS 4
\fI-1\fP if \fCcontract\fP or \fCparentKey\fP is NULL 
.br
\fI-1\fP if \fCargc\fP is 0 and \fCargv\fP is not NULL or if \fCargc\fP is not 0 and \fCargv\fP is NULL 
.br
\fI0\fP on success 
.RE
.PP

.SS "int elektraGOptsContractFromStrings (KeySet * contract, size_t argsSize, const char * args, size_t envSize, const char * env, const Key * parentKey, KeySet * goptsConfig)"

.PP
Sets up a contract for use with \fBkdbOpen()\fP that configures the gopts plugin\&. NOTE: prefer to use \fBelektraGOptsContract()\fP if possible
.PP
You can pass \fCNULL\fP for \fCargs\fP to let gopts lookup command line options internally\&. You can also pass \fCNULL\fP for \fCenv\fP to do the same for environment variables\&.
.PP
\fBParameters\fP
.RS 4
\fIcontract\fP The KeySet into which the contract will be written\&. 
.br
\fIargsSize\fP The size of the \fCargs\fP data 
.br
\fIargs\fP 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\&. 
.br
\fIenvSize\fP The size of the \fCenv\fP data 
.br
\fIenv\fP 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\&. 
.br
\fIparentKey\fP 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\&. 
.br
\fIgoptsConfig\fP The config that used to mount the gopts plugin\&. This value can be NULL\&. Only keys in the user:/ namespace will be used\&.
.RE
.PP
\fBReturn values\fP
.RS 4
\fI-1\fP if any of \fCcontract\fP or \fCparentKey\fP is NULL 
.br
\fI0\fP on success 
.RE
.PP

.SH "Author"
.PP 
Generated automatically by Doxygen for Elektra from the source code\&.
