printf("%s: bad port number-- %s\n", argv[1], argv[2]); printf ("usage: %s host-name [port]\n", argv[0]);
printf("%s: bad port number '%s'.\n", argv[1], argv[2]); printf("usage: %s host-name [port]\n", argv[0]);
setpeer(argc, argv)	int argc;	char *argv[];{	char *host;	short port;	if (connected) {		printf("Already connected to %s, use close first.\n",		    hostname);		code = -1;		return;	}	if (argc < 2)		(void)another(&argc, &argv, "to");	if (argc < 2 || argc > 3) {		printf("usage: %s host-name [port]\n", argv[0]);		code = -1;		return;	}	port = ftpport;	if (argc > 2) {		port = atoi(argv[2]);		if (port <= 0) {			printf("%s: bad port number-- %s\n", argv[1], argv[2]);			printf ("usage: %s host-name [port]\n", argv[0]);			code = -1;			return;		}		port = htons(port);	}	host = hookup(argv[1], port);	if (host) {		int overbose;		connected = 1;		/*		 * Set up defaults for FTP.		 */		(void)strcpy(typename, "ascii"), type = TYPE_A;		curtype = TYPE_A;		(void)strcpy(formname, "non-print"), form = FORM_N;		(void)strcpy(modename, "stream"), mode = MODE_S;		(void)strcpy(structname, "file"), stru = STRU_F;		(void)strcpy(bytename, "8"), bytesize = 8;		if (autologin)			(void)login(argv[1]);#if (defined(unix) || defined(BSD)) && NBBY == 8/* * this ifdef is to keep someone form "porting" this to an incompatible * system and not checking this out. This way they have to think about it. */		overbose = verbose;		if (debug == 0)			verbose = -1;		if (command("SYST") == COMPLETE && overbose) {			char *cp, c;			c = 0;			cp = strchr(reply_string+4, ' ');			if (cp == NULL)				cp = strchr(reply_string+4, '\r');			if (cp) {				if (cp[-1] == '.')					cp--;				c = *cp;				*cp = '\0';			}			printf("Remote system type is %s.\n", reply_string + 4);			if (cp)				*cp = c;		}		if (!strncmp(reply_string, "215 UNIX Type: L8", 17)) {			if (proxy)				unix_proxy = 1;			else				unix_server = 1;			/*			 * Set type to 0 (not specified by user),			 * meaning binary by default, but don't bother			 * telling server.  We can use binary			 * for text files unless changed by the user.			 */			type = 0;			(void)strcpy(typename, "binary");			if (overbose)			    printf("Using %s mode to transfer files.\n",				typename);		} else {			if (proxy)				unix_proxy = 0;			else				unix_server = 0;			if (overbose &&			    !strncmp(reply_string, "215 TOPS20", 10))				puts("Remember to set tenex mode when transferring binary files from this machine.");		}		verbose = overbose;#endif /* unix || BSD */	}}