cmd = sftp_getcmd(stdin, 0, 0);
cmd = sftp_getcmd(NULL, 0, 0);
void do_sftp(int mode, int modeflags, char *batchfile){    FILE *fp;    int ret;    /*     * Batch mode?     */    if (mode == 0) {        /* ------------------------------------------------------------------         * Now we're ready to do Real Stuff.         */        while (1) {	    struct sftp_command *cmd;	    cmd = sftp_getcmd(stdin, 0, 0);	    if (!cmd)		break;	    ret = cmd->obey(cmd);	    if (cmd->words) {		int i;		for(i = 0; i < cmd->nwords; i++)		    sfree(cmd->words[i]);		sfree(cmd->words);	    }	    sfree(cmd);	    if (ret < 0)		break;	}    } else {        fp = fopen(batchfile, "r");        if (!fp) {	    printf("Fatal: unable to open %s\n", batchfile);	    return;        }        while (1) {	    struct sftp_command *cmd;	    cmd = sftp_getcmd(fp, mode, modeflags);	    if (!cmd)		break;	    ret = cmd->obey(cmd);	    if (ret < 0)		break;	    if (ret == 0) {		if (!(modeflags & 2))		    break;	    }        }	fclose(fp);    }}