Problems in example/yajl/couchview.c


#1

@mnunberg I compile the code you put in github,and there are many errors.

:cry:

Matters focus on below mainly:

typedef void (*OPTION_HANDLER)(char cmd, const void *arg, void *cookie);
static struct {
    const char *name;
    const char *description;
    int argument;
    char letter;
    OPTION_HANDLER handler;
    void *cookie;
} my_options[256] = {
    ['?'] = {
        .name = "help",
        .description = "\t-?\t\tPrint program usage information",
        .argument = 0,
        .letter = '?',
        .handler = usage
    },
    ['U'] = {
        .name = "spec",
        .description = "\t-U spec\t\tCouchbase cluster connection string",
        .argument = 1,
        .letter = 'U',
        .handler = set_char_ptr,
        .cookie = &connstr
    },
    ['P'] = {
        .name = "password",
        .description = "\t-P password\tBucket password (if required)",
        .argument = 1,
        .letter = 'P',
        .handler = set_char_ptr,
        .cookie = &passwd,
    },
    ['o'] = {
        .name = "file",
        .description = "\t-o filename\tSend the output to this file",
        .argument = 1,
        .letter = 'o',
        .handler = set_char_ptr,
        .cookie = &filename
    },
    ['c'] = {
        .name = "chunked",
        .description = "\t-c\t\tUse chunked callback to stream the data",
        .argument = 0,
        .letter = 'c',
        .handler = set_flag,
        .cookie = &chunked
    },
    ['d'] = {
        .name = "data",
        .description = "\t-d\t\tPOST data, e.g. {\"keys\": [\"key1\", \"key2\", ...]}",
        .argument = 1,
        .letter = 'd',
        .handler = set_char_ptr,
        .cookie = &post_data
    },
    ['m'] = {
        .name = "minify",
        .description = "\t-m\t\tMinify JSON rather than beautify",
        .argument = 0,
        .letter = 'm',
        .handler = set_flag,
        .cookie = &minify
    },
    ['f'] = {
        .name = "force-utf8",
        .description = "\t-f\t\tForce utf-8, i.e. allow invalid characters inside strings during parsing",
        .argument = 0,
        .letter = 'u',
        .handler = set_flag,
        .cookie = &force_utf8
    },
};

Turn out that is my fault,I save it as .cpp :smile: I’m very sorry


#2

It appears there’s no issue here? If there is feel free to follow up on this thread.