send_packet(SSH_CMSG_EXIT_CONFIRMATION, PKT_END);
send_packet(SSH1_CMSG_EXIT_CONFIRMATION, PKT_END);
int ssh_scp_recv(unsigned char *buf, int len){    static int pending_input_len = 0;    static unsigned char *pending_input_ptr;    int to_read = len;    assert(IS_SCP);    if (pending_input_len >= to_read) {	memcpy(buf, pending_input_ptr, to_read);	pending_input_ptr += to_read;	pending_input_len -= to_read;	return len;    }        if (pending_input_len > 0) {	memcpy(buf, pending_input_ptr, pending_input_len);	buf += pending_input_len;	to_read -= pending_input_len;	pending_input_len = 0;    }    if (s == INVALID_SOCKET)	return 0;    while (to_read > 0) {	get_packet();	if (s == INVALID_SOCKET)	    return 0;	if (pktin.type == SSH_SMSG_STDOUT_DATA) {	    int plen = GET_32BIT(pktin.body);	    if (plen <= to_read) {		memcpy(buf, pktin.body + 4, plen);		buf += plen;		to_read -= plen;	    } else {		memcpy(buf, pktin.body + 4, to_read);		pending_input_len = plen - to_read;		pending_input_ptr = pktin.body + 4 + to_read;		to_read = 0;	    }	} else if (pktin.type == SSH_SMSG_STDERR_DATA) {	    int plen = GET_32BIT(pktin.body);	    fwrite(pktin.body + 4, plen, 1, stderr);	} else if (pktin.type == SSH_MSG_DISCONNECT) {		logevent("Received disconnect request");	} else if (pktin.type == SSH_SMSG_SUCCESS ||	           pktin.type == SSH_SMSG_FAILURE) {		/* ignore */	} else if (pktin.type == SSH_SMSG_EXIT_STATUS) {	    char logbuf[100];	    sprintf(logbuf, "Remote exit status: %d", GET_32BIT(pktin.body));	    logevent(logbuf);	    send_packet(SSH_CMSG_EXIT_CONFIRMATION, PKT_END);	    logevent("Closing connection");	    closesocket(s);	    s = INVALID_SOCKET;	} else {	    fatalbox("Strange packet received: type %d", pktin.type);	}    }    return len;}