if (!control) { CTRACE(tfp, "HTFTP: No control connection set up!!\n"); return -99; }  if (cmd) { CTRACE(tfp, "  Tx: %s", cmd); #ifdef NOT_ASCII { char * p; for (p = cmd; *p; p++) { *p = TOASCII(*p); } } #endif  status = NETWRITE(control->socket, cmd, (int)strlen(cmd)); if (status < 0) { CTRACE(tfp, "HTFTP: Error %d sending command: closing socket %d\n", status, control->socket); close_connection(control); return status; } }
if ((status = write_cmd(cmd)) < 0) return status;
PRIVATE int response ARGS1(	char *,		cmd){    int result;				/* Three-digit decimal code */    int continuation_response = -1;    int status;    if (!control) {	CTRACE(tfp, "HTFTP: No control connection set up!!\n");	return -99;    }    if (cmd) {	CTRACE(tfp, "  Tx: %s", cmd);#ifdef NOT_ASCII	{	    char * p;	    for (p = cmd; *p; p++) {		*p = TOASCII(*p);	    }	}#endif /* NOT_ASCII */	status = NETWRITE(control->socket, cmd, (int)strlen(cmd));	if (status < 0) {	    CTRACE(tfp, "HTFTP: Error %d sending command: closing socket %d\n",			status, control->socket);	    close_connection(control);	    return status;	}    }    do {	char *p = response_text;	for (;;) {	    int ich = NEXT_CHAR;	    if (((*p++ = ich) == LF)			|| (p == &response_text[LINE_LENGTH])) {		char continuation;		if (interrupted_in_htgetcharacter) {		    CTRACE (tfp, "HTFTP: Interrupted in HTGetCharacter, apparently.\n");		    NETCLOSE (control->socket);		    control->socket = -1;		    return HT_INTERRUPTED;		}		*p = '\0';			/* Terminate the string */		CTRACE(tfp, "    Rx: %s", response_text);		/* Check for login or help messages */		if (!strncmp(response_text,"230-",4) ||		    !strncmp(response_text,"250-",4) ||		    !strncmp(response_text,"220-",4))		    help_message_cache_add(response_text+4);		sscanf(response_text, "%d%c", &result, &continuation);		if  (continuation_response == -1) {			if (continuation == '-')  /* start continuation */			    continuation_response = result;		} else {	/* continuing */			if (continuation_response == result &&			    continuation == ' ')			    continuation_response = -1; /* ended */		}		break;	    } /* if end of line */	    if (interrupted_in_htgetcharacter) {		CTRACE (tfp, "HTFTP: Interrupted in HTGetCharacter, apparently.\n");		NETCLOSE (control->socket);		control->socket = -1;		return HT_INTERRUPTED;	    }	    if (ich == EOF) {		CTRACE(tfp, "Error on rx: closing socket %d\n",			    control->socket);		strcpy(response_text, "000 *** TCP read error on response\n");		close_connection(control);		return -1;	/* End of file on response */	    }	} /* Loop over characters */    } while (continuation_response != -1);    if (result == 421) {	CTRACE(tfp, "HTFTP: They close so we close socket %d\n",		    control->socket);	close_connection(control);	return -1;    }    if ((result == 255 && server_type == CMS_SERVER) &&	(0 == strncasecomp(cmd, "CWD", 3) ||	 0 == strcasecomp(cmd, "CDUP"))) {	/*	**  Alas, CMS returns 255 on failure to CWD to parent of root. - PG	*/	result = 555;    }    return result/100;}