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