fuse
|
Data Structures | |
struct | fuse_opt |
struct | fuse_args |
Macros | |
#define | FUSE_OPT_KEY(templ, key) { templ, -1U, key } |
#define | FUSE_OPT_END { NULL, 0, 0 } |
#define | FUSE_ARGS_INIT(argc, argv) { argc, argv, 0 } |
#define | FUSE_OPT_KEY_OPT -1 |
#define | FUSE_OPT_KEY_NONOPT -2 |
#define | FUSE_OPT_KEY_KEEP -3 |
#define | FUSE_OPT_KEY_DISCARD -4 |
Typedefs | |
typedef int(* | fuse_opt_proc_t )(void *data, const char *arg, int key, struct fuse_args *outargs) |
Functions | |
int | fuse_opt_parse (struct fuse_args *args, void *data, const struct fuse_opt opts[], fuse_opt_proc_t proc) |
int | fuse_opt_add_opt (char **opts, const char *opt) |
int | fuse_opt_add_opt_escaped (char **opts, const char *opt) |
int | fuse_opt_add_arg (struct fuse_args *args, const char *arg) |
int | fuse_opt_insert_arg (struct fuse_args *args, int pos, const char *arg) |
void | fuse_opt_free_args (struct fuse_args *args) |
int | fuse_opt_match (const struct fuse_opt opts[], const char *opt) |
This file defines the option parsing interface of FUSE
#define FUSE_ARGS_INIT | ( | argc, | |
argv | |||
) | { argc, argv, 0 } |
Initializer for 'struct fuse_args'
#define FUSE_OPT_END { NULL, 0, 0 } |
Last option. An array of 'struct fuse_opt' must end with a NULL template value
#define FUSE_OPT_KEY | ( | templ, | |
key | |||
) | { templ, -1U, key } |
Key option. In case of a match, the processing function will be called with the specified key.
#define FUSE_OPT_KEY_DISCARD -4 |
Special key value for options to discard
Argument is not passed to processing function, but behave as if the processing function returned zero
#define FUSE_OPT_KEY_KEEP -3 |
Special key value for options to keep
Argument is not passed to processing function, but behave as if the processing function returned 1
#define FUSE_OPT_KEY_NONOPT -2 |
Key value passed to the processing function for all non-options
Non-options are the arguments beginning with a character other than '-' or all arguments after the special '–' option
#define FUSE_OPT_KEY_OPT -1 |
Key value passed to the processing function if an option did not match any template
typedef int(* fuse_opt_proc_t)(void *data, const char *arg, int key, struct fuse_args *outargs) |
Processing function
This function is called if
The 'arg' parameter will always contain the whole argument or option including the parameter if exists. A two-argument option ("-x foo") is always converted to single argument option of the form "-xfoo" before this function is called.
Options of the form '-ofoo' are passed to this function without the '-o' prefix.
The return value of this function determines whether this argument is to be inserted into the output argument vector, or discarded.
data | is the user data passed to the fuse_opt_parse() function |
arg | is the whole argument or option |
key | determines why the processing function was called |
outargs | the current output argument list |
int fuse_opt_add_arg | ( | struct fuse_args * | args, |
const char * | arg | ||
) |
Add an argument to a NULL terminated argument vector
args | is the structure containing the current argument list |
arg | is the new argument to add |
int fuse_opt_add_opt | ( | char ** | opts, |
const char * | opt | ||
) |
Add an option to a comma separated option list
opts | is a pointer to an option list, may point to a NULL value |
opt | is the option to add |
int fuse_opt_add_opt_escaped | ( | char ** | opts, |
const char * | opt | ||
) |
Add an option, escaping commas, to a comma separated option list
opts | is a pointer to an option list, may point to a NULL value |
opt | is the option to add |
void fuse_opt_free_args | ( | struct fuse_args * | args | ) |
Free the contents of argument list
The structure itself is not freed
args | is the structure containing the argument list |
int fuse_opt_insert_arg | ( | struct fuse_args * | args, |
int | pos, | ||
const char * | arg | ||
) |
Add an argument at the specified position in a NULL terminated argument vector
Adds the argument to the N-th position. This is useful for adding options at the beginning of the array which must not come after the special '–' option.
args | is the structure containing the current argument list |
pos | is the position at which to add the argument |
arg | is the new argument to add |
int fuse_opt_match | ( | const struct fuse_opt | opts[], |
const char * | opt | ||
) |
Check if an option matches
opts | is the option description array |
opt | is the option to match |
int fuse_opt_parse | ( | struct fuse_args * | args, |
void * | data, | ||
const struct fuse_opt | opts[], | ||
fuse_opt_proc_t | proc | ||
) |
Option parsing function
If 'args' was returned from a previous call to fuse_opt_parse() or it was constructed from
A NULL 'args' is equivalent to an empty argument vector
A NULL 'opts' is equivalent to an 'opts' array containing a single end marker
A NULL 'proc' is equivalent to a processing function always returning '1'
args | is the input and output argument list |
data | is the user data |
opts | is the option description array |
proc | is the processing function |