コード例 #1
0
ファイル: prefix_puts_packet.hpp プロジェクト: alibaba/tair
    virtual void dump() const {
        char ascii_key[72];
        ascii_key[0] = '\0';
        const data_entry *picked = pick_key();
        if (picked != NULL) {
            pick_key()->to_ascii(ascii_key, sizeof(ascii_key));
        }

        fprintf(stderr,
                "op: %s(%d)\n\t"
                        "area: %d, key_count: %d, packet size: %lu, server_flag:%d\n\t"
                        "key: %s\n",
                name(getPCode()), getPCode(), area, key_count, size(), server_flag, ascii_key);
    }
コード例 #2
0
ファイル: wndo-pick.c プロジェクト: wijjo/wndo
int main(int argc, char* argv[])
{
    char* nameDsp = NULL;           // name of server to contact
    Bool optKey = False;

    nameProg = argv[0];
    char* slash = strrchr(nameProg, '/');
    if (slash != NULL)
        nameProg = slash + 1;

    int i;
    for (i = 1; i < argc; i++)
    {
        char* arg = argv[i];

        if (arg[0] == '-')
        {
            if (strchr(arg, 'd') != NULL)
            {
                if (++i >= argc || argv[i][0] != ':')
                    usage();
                nameDsp = argv[i];
            }
            if (strchr(arg, 'k') != NULL)
                optKey = True;
            if (strchr(arg, 'v') != NULL)
                verbose = True;
            if (strspn(arg+1, "kvd") != strlen(arg+1))
                usage();
        }
        else
            usage();
    }

    dpy = XOpenDisplay(nameDsp);
    if (!dpy)
        error_exit("unable to open display \"%s\"", XDisplayName(nameDsp));

    int screen = DefaultScreen(dpy);

    int button = get_button1();

    if (optKey)
        pick_key(screen);
    else
        pick_window(screen, button);

    cleanup_and_exit(0);

    /*NOTREACHED*/
    return 0;
}