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

int fuse_opt_add_arg ( struct fuse_args args,
const char *  arg 
)

Add an argument to a NULL terminated argument vector

Parameters:
args is the structure containing the current argument list
arg is the new argument to add
Returns:
-1 on allocation error, 0 on success

Definition at line 50 of file fuse_opt.c.

References fuse_args::allocated, fuse_args::argc, fuse_args::argv, and fuse_opt_add_arg().

Referenced by fuse_opt_add_arg().

{
      char **newargv;
      char *newarg;

      assert(!args->argv || args->allocated);

      newargv = realloc(args->argv, (args->argc + 2) * sizeof(char *));
      newarg = newargv ? strdup(arg) : NULL;
      if (!newargv || !newarg)
            return alloc_failed();

      args->argv = newargv;
      args->allocated = 1;
      args->argv[args->argc++] = newarg;
      args->argv[args->argc] = NULL;
      return 0;
}


Generated by  Doxygen 1.6.0   Back to index