示例#1
0
文件: fuse_opt.c 项目: AllardJ/Tomato
static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
{
    char *sep;

    do {
        int res;
#ifdef __SOLARIS__
                /*
                 * On Solaris, the device name contains commas, so the
                 * option "fsname" has to be the last one and its commas
                 * should not be interpreted as option separators.
                 * This had to be hardcoded because the option "fsname"
                 * may be found though not present in option list.
                 */
        if (!strncmp(opts,"fsname=",7))
            sep = (char*)NULL;
        else
#endif /* __SOLARIS__ */
            {
            sep = strchr(opts, ',');
            if (sep)
                *sep = '\0';
        }
        res = process_gopt(ctx, opts, 1);
        if (res == -1)
            return -1;
        opts = sep + 1;
    } while (sep);

    return 0;
}
示例#2
0
文件: fuse_opt.c 项目: pwasmund/fuse
static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
{
    char *s = opts;
    char *d = s;
    int end = 0;

    while (!end) {
        if (*s == '\0')
            end = 1;
        if (*s == ',' || end) {
            int res;

            *d = '\0';
            res = process_gopt(ctx, opts, 1);
            if (res == -1)
                return -1;
            d = opts;
        } else {
            if (s[0] == '\\' && s[1] != '\0')
                s++;
            *d++ = *s;
        }
        s++;
    }

    return 0;
}
示例#3
0
文件: fuse_opt.c 项目: AllardJ/Tomato
static int process_option_group(struct fuse_opt_context *ctx, const char *opts)
{
    int res;
    char *copy;
    const char *sep = strchr(opts, ',');
    if (!sep)
        return process_gopt(ctx, opts, 1);

    copy = strdup(opts);
    if (!copy) {
        fprintf(stderr, "fuse: memory allocation failed\n");
        return -1;
    }
    res = process_real_option_group(ctx, copy);
    free(copy);
    return res;
}
示例#4
0
static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
{
    char *sep;

    do {
        int res;
        sep = strchr(opts, ',');
        if (sep)
            *sep = '\0';
        res = process_gopt(ctx, opts, 1);
        if (res == -1)
            return (-1);
        opts = sep + 1;
    } while (sep);

    return (0);
}
示例#5
0
文件: fuse_opt.c 项目: AllardJ/Tomato
static int process_one(struct fuse_opt_context *ctx, const char *arg)
{
    if (ctx->nonopt || arg[0] != '-')
        return call_proc(ctx, arg, FUSE_OPT_KEY_NONOPT, 0);
    else if (arg[1] == 'o') {
        if (arg[2])
            return process_option_group(ctx, arg + 2);
        else {
            if (next_arg(ctx, arg) == -1)
                return -1;

            return process_option_group(ctx, ctx->argv[ctx->argctr]);
        }
    } else if (arg[1] == '-' && !arg[2]) {
        if (add_arg(ctx, arg) == -1)
            return -1;
        ctx->nonopt = ctx->outargs.argc;
        return 0;
    } else
        return process_gopt(ctx, arg, 0);
}
示例#6
0
static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
{
	char *s = opts;
	char *d = s;
	int end = 0;

	while (!end) {
		if (*s == '\0')
			end = 1;
		if (*s == ',' || end) {
			int res;

			*d = '\0';
			res = process_gopt(ctx, opts, 1);
			if (res == -1)
				return -1;
			d = opts;
		} else {
			if (s[0] == '\\' && s[1] != '\0') {
				s++;
				if (s[0] >= '0' && s[0] <= '3' &&
				    s[1] >= '0' && s[1] <= '7' &&
				    s[2] >= '0' && s[2] <= '7') {
					*d++ = (s[0] - '0') * 0100 +
						(s[1] - '0') * 0010 +
						(s[2] - '0');
					s += 2;
				} else {
					*d++ = *s;
				}
			} else {
				*d++ = *s;
			}
		}
		s++;
	}

	return 0;
}
示例#7
0
文件: fuse_opt.c 项目: ctheanh/X3c50
static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
{
    char *sep;

    do {
        int res;
                /*
                 * On Solaris, the device name contains commas, so the
                 * option "fsname" has to be the last one and its commas
                 * should not be interpreted as option separators.
                 * This had to be hardcoded because the option "fsname"
                 * may be found though not present in option list.
                 */
 /*lenovo-sw liuyc7 2016.1.12 modified begin*/
        if (!strncmp(opts,"fsname=",7)){
            sep = strchr(opts, ',');
            if ( sep && ((*(sep+1))<='9') && (*(sep+1)>='0') ){
                char *tmp=sep+1;
                sep = strchr(tmp, ',');
                if (sep)
                   *sep = '\0';
            }
        }else{
            sep = strchr(opts, ',');
            if (sep)
               *sep = '\0';
        }
/*lenovo-sw liuyc7 2016.1.12 end*/
        res = process_gopt(ctx, opts, 1);
        if (res == -1)
            return -1;
        opts = sep + 1;
    } while (sep);

    return 0;
}