i = 0;
i = ret = 0;
void dup_session_menuitem(GtkMenuItem *item, gpointer gdata){    struct gui_data *inst = (struct gui_data *)gdata;    /*     * For this feature we must marshal cfg and (possibly) pty_argv     * into a byte stream, create a pipe, and send this byte stream     * to the child through the pipe.     */    int i, ret, size;    char *data;    char option[80];    int pipefd[2];    if (pipe(pipefd) < 0) {	perror("pipe");	return;    }    size = sizeof(inst->cfg);    if (use_pty_argv && pty_argv) {	for (i = 0; pty_argv[i]; i++)	    size += strlen(pty_argv[i]) + 1;    }    data = snewn(size, char);    memcpy(data, &inst->cfg, sizeof(inst->cfg));    if (use_pty_argv && pty_argv) {	int p = sizeof(inst->cfg);	for (i = 0; pty_argv[i]; i++) {	    strcpy(data + p, pty_argv[i]);	    p += strlen(pty_argv[i]) + 1;	}	assert(p == size);    }    sprintf(option, "---[%d,%d]", pipefd[0], size);    fcntl(pipefd[0], F_SETFD, 0);    fork_and_exec_self(inst, pipefd[1], option, NULL);    close(pipefd[0]);    i = 0;    while (i < size && (ret = write(pipefd[1], data + i, size - i)) > 0)	i += ret;    if (ret < 0)	perror("write to pipe");    close(pipefd[1]);    sfree(data);}