[c5c522c] | 1 | diff -up netkit-ftp-0.17/ftp/cmds.c.old netkit-ftp-0.17/ftp/cmds.c |
---|
| 2 | --- netkit-ftp-0.17/ftp/cmds.c.old 2007-11-15 13:34:31.000000000 +0100 |
---|
| 3 | +++ netkit-ftp-0.17/ftp/cmds.c 2007-11-15 13:44:44.000000000 +0100 |
---|
| 4 | @@ -137,7 +137,7 @@ static char *pathprotect(char *name) |
---|
| 5 | if (name[i]=='.' && gotdots>=0) gotdots++; |
---|
| 6 | else if (name[i]=='/' && gotdots<0) gotdots=0; |
---|
| 7 | else if (name[i]=='/' && gotdots==2) { |
---|
| 8 | - printf("Warning: embedded .. in %.*s (changing to !!)\n", |
---|
| 9 | + fprintf(stderr, "Warning: embedded .. in %.*s (changing to !!)\n", |
---|
| 10 | len-1, name); |
---|
| 11 | name[i-1] = '!'; |
---|
| 12 | name[i-2] = '!'; |
---|
| 13 | @@ -167,7 +167,7 @@ another(int *pargc, char ***pargv, const |
---|
| 14 | int ret; |
---|
| 15 | |
---|
| 16 | if (len >= sizeof(line) - 3) { |
---|
| 17 | - printf("sorry, arguments too long\n"); |
---|
| 18 | + fprintf(stderr, "sorry, arguments too long\n"); |
---|
| 19 | intr(0); |
---|
| 20 | } |
---|
| 21 | printf("(%s) ", prompt); |
---|
| 22 | @@ -195,7 +195,7 @@ setpeer(int argc, char *argv[]) |
---|
| 23 | char *port; |
---|
| 24 | |
---|
| 25 | if (connected) { |
---|
| 26 | - printf("Already connected to %s, use close first.\n", |
---|
| 27 | + fprintf(stderr, "Already connected to %s, use close first.\n", |
---|
| 28 | hostname); |
---|
| 29 | code = -1; |
---|
| 30 | return; |
---|
| 31 | @@ -278,7 +278,7 @@ setpeer(int argc, char *argv[]) |
---|
| 32 | unix_server = 0; |
---|
| 33 | if (overbose && |
---|
| 34 | !strncmp(reply_string, "215 TOPS20", 10)) |
---|
| 35 | - printf( |
---|
| 36 | + fprintf(stderr, |
---|
| 37 | "Remember to set tenex mode when transfering binary files from this machine.\n"); |
---|
| 38 | } |
---|
| 39 | verbose = overbose; |
---|
| 40 | @@ -316,7 +316,7 @@ do_settype(const char *thetype) |
---|
| 41 | if (strcmp(thetype, p->t_name) == 0) |
---|
| 42 | break; |
---|
| 43 | if (p->t_name == 0) { |
---|
| 44 | - printf("%s: unknown mode\n", thetype); |
---|
| 45 | + fprintf(stderr, "%s: unknown mode\n", thetype); |
---|
| 46 | code = -1; |
---|
| 47 | return; |
---|
| 48 | } |
---|
| 49 | @@ -378,7 +378,7 @@ changetype(int newtype, int show) |
---|
| 50 | if (newtype == p->t_type) |
---|
| 51 | break; |
---|
| 52 | if (p->t_name == 0) { |
---|
| 53 | - printf("ftp: internal error: unknown type %d\n", newtype); |
---|
| 54 | + fprintf(stderr, "ftp: internal error: unknown type %d\n", newtype); |
---|
| 55 | return; |
---|
| 56 | } |
---|
| 57 | if (newtype == TYPE_L && bytename[0] != '\0') |
---|
| 58 | @@ -428,7 +428,7 @@ settenex(void) |
---|
| 59 | void |
---|
| 60 | setmode(void) |
---|
| 61 | { |
---|
| 62 | - printf("We only support %s mode, sorry.\n", modename); |
---|
| 63 | + fprintf(stderr, "We only support %s mode, sorry.\n", modename); |
---|
| 64 | code = -1; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | @@ -439,7 +439,7 @@ setmode(void) |
---|
| 68 | void |
---|
| 69 | setform(void) |
---|
| 70 | { |
---|
| 71 | - printf("We only support %s format, sorry.\n", formname); |
---|
| 72 | + fprintf(stderr, "We only support %s format, sorry.\n", formname); |
---|
| 73 | code = -1; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | @@ -449,7 +449,7 @@ setform(void) |
---|
| 77 | void |
---|
| 78 | setstruct(void) |
---|
| 79 | { |
---|
| 80 | - printf("We only support %s structure, sorry.\n", structname); |
---|
| 81 | + fprintf(stderr, "We only support %s structure, sorry.\n", structname); |
---|
| 82 | code = -1; |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | @@ -594,7 +594,7 @@ mput(int argc, char *argv[]) |
---|
| 86 | } |
---|
| 87 | gargs = ftpglob(argv[i]); |
---|
| 88 | if (globerr != NULL) { |
---|
| 89 | - printf("%s\n", globerr); |
---|
| 90 | + fprintf(stderr, "%s\n", globerr); |
---|
| 91 | if (gargs) { |
---|
| 92 | blkfree(gargs); |
---|
| 93 | free((char *)gargs); |
---|
| 94 | @@ -906,7 +906,7 @@ remglob(char *argv[], int doswitch) |
---|
| 95 | umask(oldumask); |
---|
| 96 | |
---|
| 97 | if (fd<0) { |
---|
| 98 | - printf("Error creating temporary file, oops\n"); |
---|
| 99 | + fprintf(stderr, "Error creating temporary file, oops\n"); |
---|
| 100 | return NULL; |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | @@ -931,13 +931,13 @@ remglob(char *argv[], int doswitch) |
---|
| 104 | } |
---|
| 105 | verbose = oldverbose; hash = oldhash; |
---|
| 106 | if (badglob) { |
---|
| 107 | - printf("Refusing to handle insecure file list\n"); |
---|
| 108 | + fprintf(stderr, "Refusing to handle insecure file list\n"); |
---|
| 109 | close(fd); |
---|
| 110 | return NULL; |
---|
| 111 | } |
---|
| 112 | ftemp = fdopen(fd, "r"); |
---|
| 113 | if (ftemp == NULL) { |
---|
| 114 | - printf("fdopen failed, oops\n"); |
---|
| 115 | + fprintf(stderr, "fdopen failed, oops\n"); |
---|
| 116 | return NULL; |
---|
| 117 | } |
---|
| 118 | rewind(ftemp); |
---|
| 119 | @@ -1006,7 +1006,7 @@ checkglob(int fd, const char *pattern) |
---|
| 120 | while (*sp == '/') |
---|
| 121 | sp++; |
---|
| 122 | if (nrslash >= MAXPATHLEN) { |
---|
| 123 | - printf("Incredible pattern: %s\n", pattern); |
---|
| 124 | + fprintf(stderr, "Incredible pattern: %s\n", pattern); |
---|
| 125 | return 0; |
---|
| 126 | } |
---|
| 127 | dotdot[nrslash++] = isdotdotglob(sp); |
---|
| 128 | @@ -1019,7 +1019,7 @@ checkglob(int fd, const char *pattern) |
---|
| 129 | if ((sp = strchr(buffer, '\n')) != 0) { |
---|
| 130 | *sp = '\0'; |
---|
| 131 | } else { |
---|
| 132 | - printf("Extremely long filename from server: %s", |
---|
| 133 | + fprintf(stderr, "Extremely long filename from server: %s", |
---|
| 134 | buffer); |
---|
| 135 | okay = 0; |
---|
| 136 | break; |
---|
| 137 | @@ -1038,7 +1038,7 @@ checkglob(int fd, const char *pattern) |
---|
| 138 | } |
---|
| 139 | |
---|
| 140 | if (!okay) |
---|
| 141 | - printf("Filename provided by server " |
---|
| 142 | + fprintf(stderr, "Filename provided by server " |
---|
| 143 | "doesn't match pattern `%s': %s\n", pattern, buffer); |
---|
| 144 | |
---|
| 145 | fclose(fp); |
---|
| 146 | @@ -1061,14 +1061,14 @@ status(void) |
---|
| 147 | if (connected) |
---|
| 148 | printf("Connected to %s.\n", hostname); |
---|
| 149 | else |
---|
| 150 | - printf("Not connected.\n"); |
---|
| 151 | + fprintf(stderr, "Not connected.\n"); |
---|
| 152 | if (!proxy) { |
---|
| 153 | pswitch(1); |
---|
| 154 | if (connected) { |
---|
| 155 | printf("Connected for proxy commands to %s.\n", hostname); |
---|
| 156 | } |
---|
| 157 | else { |
---|
| 158 | - printf("No proxy connection.\n"); |
---|
| 159 | + fprintf(stderr, "No proxy connection.\n"); |
---|
| 160 | } |
---|
| 161 | pswitch(0); |
---|
| 162 | } |
---|
| 163 | @@ -1218,7 +1218,7 @@ setdebug(int argc, char *argv[]) |
---|
| 164 | if (argc > 1) { |
---|
| 165 | val = atoi(argv[1]); |
---|
| 166 | if (val < 0) { |
---|
| 167 | - printf("%s: bad debugging value.\n", argv[1]); |
---|
| 168 | + fprintf(stderr, "%s: bad debugging value.\n", argv[1]); |
---|
| 169 | code = -1; |
---|
| 170 | return; |
---|
| 171 | } |
---|
| 172 | @@ -1248,7 +1248,7 @@ cd(int argc, char *argv[]) |
---|
| 173 | } |
---|
| 174 | if (command("CWD %s", argv[1]) == ERROR && code == 500) { |
---|
| 175 | if (verbose) |
---|
| 176 | - printf("CWD command not recognized, trying XCWD\n"); |
---|
| 177 | + fprintf(stderr, "CWD command not recognized, trying XCWD\n"); |
---|
| 178 | (void) command("XCWD %s", argv[1]); |
---|
| 179 | } |
---|
| 180 | } |
---|
| 181 | @@ -1546,7 +1546,7 @@ user(int argc, char *argv[]) |
---|
| 182 | aflag++; |
---|
| 183 | } |
---|
| 184 | if (n != COMPLETE) { |
---|
| 185 | - fprintf(stdout, "Login failed.\n"); |
---|
| 186 | + fprintf(stderr, "Login failed.\n"); |
---|
| 187 | return; |
---|
| 188 | } |
---|
| 189 | if (!aflag && argc == 4) { |
---|
| 190 | @@ -1567,7 +1567,7 @@ pwd(void) |
---|
| 191 | */ |
---|
| 192 | verbose = 1; |
---|
| 193 | if (command("PWD") == ERROR && code == 500) { |
---|
| 194 | - printf("PWD command not recognized, trying XPWD\n"); |
---|
| 195 | + fprintf(stderr, "PWD command not recognized, trying XPWD\n"); |
---|
| 196 | (void) command("XPWD"); |
---|
| 197 | } |
---|
| 198 | verbose = oldverbose; |
---|
| 199 | @@ -1587,7 +1587,7 @@ makedir(int argc, char *argv[]) |
---|
| 200 | } |
---|
| 201 | if (command("MKD %s", argv[1]) == ERROR && code == 500) { |
---|
| 202 | if (verbose) |
---|
| 203 | - printf("MKD command not recognized, trying XMKD\n"); |
---|
| 204 | + fprintf(stderr, "MKD command not recognized, trying XMKD\n"); |
---|
| 205 | (void) command("XMKD %s", argv[1]); |
---|
| 206 | } |
---|
| 207 | } |
---|
| 208 | @@ -1606,7 +1606,7 @@ removedir(int argc, char *argv[]) |
---|
| 209 | } |
---|
| 210 | if (command("RMD %s", argv[1]) == ERROR && code == 500) { |
---|
| 211 | if (verbose) |
---|
| 212 | - printf("RMD command not recognized, trying XRMD\n"); |
---|
| 213 | + fprintf(stderr, "RMD command not recognized, trying XRMD\n"); |
---|
| 214 | (void) command("XRMD %s", argv[1]); |
---|
| 215 | } |
---|
| 216 | } |
---|
| 217 | @@ -2212,7 +2212,7 @@ cdup(void) |
---|
| 218 | { |
---|
| 219 | if (command("CDUP") == ERROR && code == 500) { |
---|
| 220 | if (verbose) |
---|
| 221 | - printf("CDUP command not recognized, trying XCUP\n"); |
---|
| 222 | + fprintf(stderr, "CDUP command not recognized, trying XCUP\n"); |
---|
| 223 | (void) command("XCUP"); |
---|
| 224 | } |
---|
| 225 | } |
---|