09d58c
diff -up netkit-ftp-0.17/ftp/cmds.c.old netkit-ftp-0.17/ftp/cmds.c
09d58c
--- netkit-ftp-0.17/ftp/cmds.c.old	2007-11-15 13:34:31.000000000 +0100
09d58c
+++ netkit-ftp-0.17/ftp/cmds.c	2007-11-15 13:44:44.000000000 +0100
09d58c
@@ -137,7 +137,7 @@ static char *pathprotect(char *name)
09d58c
 		if (name[i]=='.' && gotdots>=0) gotdots++;
09d58c
 		else if (name[i]=='/' && gotdots<0) gotdots=0;
09d58c
 		else if (name[i]=='/' && gotdots==2) {
09d58c
-		    printf("Warning: embedded .. in %.*s (changing to !!)\n",
09d58c
+		    fprintf(stderr, "Warning: embedded .. in %.*s (changing to !!)\n",
09d58c
 			   len-1, name);
09d58c
 		    name[i-1] = '!';
09d58c
 		    name[i-2] = '!';
09d58c
@@ -167,7 +167,7 @@ another(int *pargc, char ***pargv, const
09d58c
 	int ret;
09d58c
 
09d58c
 	if (len >= sizeof(line) - 3) {
09d58c
-		printf("sorry, arguments too long\n");
09d58c
+		fprintf(stderr, "sorry, arguments too long\n");
09d58c
 		intr(0);
09d58c
 	}
09d58c
 	printf("(%s) ", prompt);
09d58c
@@ -195,7 +195,7 @@ setpeer(int argc, char *argv[])
09d58c
 	char *port;
09d58c
 
09d58c
 	if (connected) {
09d58c
-		printf("Already connected to %s, use close first.\n",
09d58c
+		fprintf(stderr, "Already connected to %s, use close first.\n",
09d58c
 			hostname);
09d58c
 		code = -1;
09d58c
 		return;
09d58c
@@ -278,7 +278,7 @@ setpeer(int argc, char *argv[])
09d58c
 				unix_server = 0;
09d58c
 			if (overbose && 
09d58c
 			    !strncmp(reply_string, "215 TOPS20", 10))
09d58c
-				printf(
09d58c
+				fprintf(stderr, 
09d58c
 "Remember to set tenex mode when transfering binary files from this machine.\n");
09d58c
 		}
09d58c
 		verbose = overbose;
09d58c
@@ -316,7 +316,7 @@ do_settype(const char *thetype) 
09d58c
 		if (strcmp(thetype, p->t_name) == 0)
09d58c
 			break;
09d58c
 	if (p->t_name == 0) {
09d58c
-		printf("%s: unknown mode\n", thetype);
09d58c
+		fprintf(stderr, "%s: unknown mode\n", thetype);
09d58c
 		code = -1;
09d58c
 		return;
09d58c
 	}
09d58c
@@ -378,7 +378,7 @@ changetype(int newtype, int show)
09d58c
 		if (newtype == p->t_type)
09d58c
 			break;
09d58c
 	if (p->t_name == 0) {
09d58c
-		printf("ftp: internal error: unknown type %d\n", newtype);
09d58c
+		fprintf(stderr, "ftp: internal error: unknown type %d\n", newtype);
09d58c
 		return;
09d58c
 	}
09d58c
 	if (newtype == TYPE_L && bytename[0] != '\0')
09d58c
@@ -428,7 +428,7 @@ settenex(void)
09d58c
 void
09d58c
 setmode(void)
09d58c
 {
09d58c
-	printf("We only support %s mode, sorry.\n", modename);
09d58c
+	fprintf(stderr, "We only support %s mode, sorry.\n", modename);
09d58c
 	code = -1;
09d58c
 }
09d58c
 
09d58c
@@ -439,7 +439,7 @@ setmode(void)
09d58c
 void
09d58c
 setform(void)
09d58c
 {
09d58c
-	printf("We only support %s format, sorry.\n", formname);
09d58c
+	fprintf(stderr, "We only support %s format, sorry.\n", formname);
09d58c
 	code = -1;
09d58c
 }
09d58c
 
09d58c
@@ -449,7 +449,7 @@ setform(void)
09d58c
 void
09d58c
 setstruct(void)
09d58c
 {
09d58c
-	printf("We only support %s structure, sorry.\n", structname);
09d58c
+	fprintf(stderr, "We only support %s structure, sorry.\n", structname);
09d58c
 	code = -1;
09d58c
 }
09d58c
 
09d58c
@@ -594,7 +594,7 @@ mput(int argc, char *argv[])
09d58c
 		}
09d58c
 		gargs = ftpglob(argv[i]);
09d58c
 		if (globerr != NULL) {
09d58c
-			printf("%s\n", globerr);
09d58c
+			fprintf(stderr, "%s\n", globerr);
09d58c
 			if (gargs) {
09d58c
 				blkfree(gargs);
09d58c
 				free((char *)gargs);
09d58c
@@ -906,7 +906,7 @@ remglob(char *argv[], int doswitch)
09d58c
 		umask(oldumask);
09d58c
 
09d58c
 		if (fd<0) {
09d58c
-			printf("Error creating temporary file, oops\n");
09d58c
+			fprintf(stderr, "Error creating temporary file, oops\n");
09d58c
 			return NULL;
09d58c
 		}
09d58c
 		
09d58c
@@ -931,13 +931,13 @@ remglob(char *argv[], int doswitch)
09d58c
 		}
09d58c
 		verbose = oldverbose; hash = oldhash;
09d58c
 		if (badglob) {
09d58c
-			printf("Refusing to handle insecure file list\n");
09d58c
+			fprintf(stderr, "Refusing to handle insecure file list\n");
09d58c
 			close(fd);
09d58c
 			return NULL;
09d58c
 		}
09d58c
 		ftemp = fdopen(fd, "r");
09d58c
 		if (ftemp == NULL) {
09d58c
-			printf("fdopen failed, oops\n");
09d58c
+			fprintf(stderr, "fdopen failed, oops\n");
09d58c
 			return NULL;
09d58c
 		}
09d58c
 		rewind(ftemp);
09d58c
@@ -1006,7 +1006,7 @@ checkglob(int fd, const char *pattern)
09d58c
 		while (*sp == '/')
09d58c
 			sp++;
09d58c
 		if (nrslash >= MAXPATHLEN) {
09d58c
-			printf("Incredible pattern: %s\n", pattern);
09d58c
+			fprintf(stderr, "Incredible pattern: %s\n", pattern);
09d58c
 			return 0;
09d58c
 		}
09d58c
 		dotdot[nrslash++] = isdotdotglob(sp);
09d58c
@@ -1019,7 +1019,7 @@ checkglob(int fd, const char *pattern)
09d58c
 		if ((sp = strchr(buffer, '\n')) != 0) {
09d58c
 			*sp = '\0';
09d58c
 		} else {
09d58c
-			printf("Extremely long filename from server: %s",
09d58c
+			fprintf(stderr, "Extremely long filename from server: %s",
09d58c
 				buffer);
09d58c
 			okay = 0;
09d58c
 			break;
09d58c
@@ -1038,7 +1038,7 @@ checkglob(int fd, const char *pattern)
09d58c
 	}
09d58c
 
09d58c
 	if (!okay)
09d58c
-		printf("Filename provided by server "
09d58c
+		fprintf(stderr, "Filename provided by server "
09d58c
 		       "doesn't match pattern `%s': %s\n", pattern, buffer);
09d58c
 
09d58c
 	fclose(fp);
09d58c
@@ -1061,14 +1061,14 @@ status(void)
09d58c
 	if (connected) 
09d58c
 		printf("Connected to %s.\n", hostname);
09d58c
 	else 
09d58c
-		printf("Not connected.\n");
09d58c
+		fprintf(stderr, "Not connected.\n");
09d58c
 	if (!proxy) {
09d58c
 		pswitch(1);
09d58c
 		if (connected) {
09d58c
 			printf("Connected for proxy commands to %s.\n", hostname);
09d58c
 		}
09d58c
 		else {
09d58c
-			printf("No proxy connection.\n");
09d58c
+			fprintf(stderr, "No proxy connection.\n");
09d58c
 		}
09d58c
 		pswitch(0);
09d58c
 	}
09d58c
@@ -1218,7 +1218,7 @@ setdebug(int argc, char *argv[])
09d58c
 	if (argc > 1) {
09d58c
 		val = atoi(argv[1]);
09d58c
 		if (val < 0) {
09d58c
-			printf("%s: bad debugging value.\n", argv[1]);
09d58c
+			fprintf(stderr, "%s: bad debugging value.\n", argv[1]);
09d58c
 			code = -1;
09d58c
 			return;
09d58c
 		}
09d58c
@@ -1248,7 +1248,7 @@ cd(int argc, char *argv[])
09d58c
 	}
09d58c
 	if (command("CWD %s", argv[1]) == ERROR && code == 500) {
09d58c
 		if (verbose)
09d58c
-			printf("CWD command not recognized, trying XCWD\n");
09d58c
+			fprintf(stderr, "CWD command not recognized, trying XCWD\n");
09d58c
 		(void) command("XCWD %s", argv[1]);
09d58c
 	}
09d58c
 }
09d58c
@@ -1546,7 +1546,7 @@ user(int argc, char *argv[])
09d58c
 		aflag++;
09d58c
 	}
09d58c
 	if (n != COMPLETE) {
09d58c
-		fprintf(stdout, "Login failed.\n");
09d58c
+		fprintf(stderr, "Login failed.\n");
09d58c
 		return;
09d58c
 	}
09d58c
 	if (!aflag && argc == 4) {
09d58c
@@ -1567,7 +1567,7 @@ pwd(void)
09d58c
 	 */
09d58c
 	verbose = 1;
09d58c
 	if (command("PWD") == ERROR && code == 500) {
09d58c
-		printf("PWD command not recognized, trying XPWD\n");
09d58c
+		fprintf(stderr, "PWD command not recognized, trying XPWD\n");
09d58c
 		(void) command("XPWD");
09d58c
 	}
09d58c
 	verbose = oldverbose;
09d58c
@@ -1587,7 +1587,7 @@ makedir(int argc, char *argv[])
09d58c
 	}
09d58c
 	if (command("MKD %s", argv[1]) == ERROR && code == 500) {
09d58c
 		if (verbose)
09d58c
-			printf("MKD command not recognized, trying XMKD\n");
09d58c
+			fprintf(stderr, "MKD command not recognized, trying XMKD\n");
09d58c
 		(void) command("XMKD %s", argv[1]);
09d58c
 	}
09d58c
 }
09d58c
@@ -1606,7 +1606,7 @@ removedir(int argc, char *argv[])
09d58c
 	}
09d58c
 	if (command("RMD %s", argv[1]) == ERROR && code == 500) {
09d58c
 		if (verbose)
09d58c
-			printf("RMD command not recognized, trying XRMD\n");
09d58c
+			fprintf(stderr, "RMD command not recognized, trying XRMD\n");
09d58c
 		(void) command("XRMD %s", argv[1]);
09d58c
 	}
09d58c
 }
09d58c
@@ -2212,7 +2212,7 @@ cdup(void)
09d58c
 {
09d58c
 	if (command("CDUP") == ERROR && code == 500) {
09d58c
 		if (verbose)
09d58c
-			printf("CDUP command not recognized, trying XCUP\n");
09d58c
+			fprintf(stderr, "CDUP command not recognized, trying XCUP\n");
09d58c
 		(void) command("XCUP");
09d58c
 	}
09d58c
 }