Lines Matching refs:opt
143 static int add_opt(char **opts, const char *opt, bool escape)
146 char* buf = realloc(*opts, orig_len + 1 + strlen(opt) * 2 + 1);
158 for (; *opt; opt++) {
159 if (escape && (*opt == ',' || *opt == '\\')) {
162 *buf++ = *opt;
169 int fuse_opt_add_opt(char **opts, const char *opt)
171 DPRINTF(("%s: arguments passed: [opts=%s] [opt=%s]\n",
172 __func__, *opts, opt));
173 return add_opt(opts, opt, false);
176 int fuse_opt_add_opt_escaped(char **opts, const char *opt)
178 DPRINTF(("%s: arguments passed: [opts=%s] [opt=%s]\n",
179 __func__, *opts, opt));
180 return add_opt(opts, opt, true);
183 static bool match_templ(const char *templ, const char *opt, ssize_t *sep_idx)
191 if (strlen(opt) >= cmp_len && strncmp(templ, opt, cmp_len) == 0) {
201 if (strcmp(templ, opt) == 0) {
213 find_opt(const struct fuse_opt *opts, const char *opt, ssize_t *sep_idx)
216 if (match_templ(opts->templ, opt, sep_idx))
223 * Returns 1 if opt was matched with any option from opts,
227 fuse_opt_match(const struct fuse_opt *opts, const char *opt)
229 return find_opt(opts, opt, NULL) != NULL ? 1 : 0;
286 const struct fuse_opt* opt, ssize_t sep_idx, void* data,
289 if (opt->offset == -1) {
292 if (call_proc(proc, data, arg, opt->value, outargs, is_opt) == -1)
296 void *var = (char*)data + opt->offset;
298 if (sep_idx > 0 && opt->templ[sep_idx + 1] == '%') {
301 opt->templ[sep_idx] == '=' ? &arg[sep_idx + 1] : &arg[sep_idx];
303 if (opt->templ[sep_idx + 2] == 's') {
316 if (sscanf(param, &opt->templ[sep_idx + 1], var) == -1) {
320 param, (int)sep_idx, opt->templ);
327 *(int *)var = opt->value;
340 const struct fuse_opt *opt = find_opt(opts, arg, &sep_idx);
342 if (opt) {
345 for (; opt != NULL && opt->templ != NULL;
346 opt = find_opt(++opt, arg, &sep_idx)) {
348 if (sep_idx > 0 && opt->templ[sep_idx] == ' ' &&
366 rv = parse_matched_arg(new_arg, outargs, opt, sep_idx,
375 rv = parse_matched_arg(arg, outargs, opt, sep_idx,
396 char *opt;
401 if ((opt = malloc(strlen(arg) + 1)) == NULL)
406 opt[opt_len] = '\0';
407 if (parse_arg(args, argi, opt, outargs,
409 free(opt);
417 opt[opt_len++] = arg[i+1];
421 opt[opt_len++] = arg[i];
426 opt[opt_len] = '\0';
427 if (parse_arg(args, argi, opt, outargs, data, opts, proc, true) == -1) {
428 free(opt);
432 free(opt);