Logo Search packages:      
Sourcecode: fuse version File versions  Download package

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'

Parameters:
args is the input and output argument list
data is the user data
opts is the option description array
proc is the processing function
Returns:
-1 on error, 0 on success

Definition at line 358 of file fuse_opt.c.

References fuse_args::argc, fuse_args::argv, fuse_opt_free_args(), and fuse_opt_parse().

Referenced by fuse_opt_parse(), and fuse_parse_cmdline().

{
      int res;
      struct fuse_opt_context ctx = {
            .data = data,
            .opt = opts,
            .proc = proc,
      };

      if (!args || !args->argv || !args->argc)
            return 0;

      ctx.argc = args->argc;
      ctx.argv = args->argv;

      res = opt_parse(&ctx);
      if (res != -1) {
            struct fuse_args tmp = *args;
            *args = ctx.outargs;
            ctx.outargs = tmp;
      }
      free(ctx.opts);
      fuse_opt_free_args(&ctx.outargs);
      return res;
}


Generated by  Doxygen 1.6.0   Back to index