prefix local error messages with "local:" to lessen user confusion.
SCCS-vsn: usr.bin/ftp/cmds.c 5.21
SCCS-vsn: usr.bin/ftp/ftp.c 5.31
-static char sccsid[] = "@(#)cmds.c 5.20 (Berkeley) %G%";
+static char sccsid[] = "@(#)cmds.c 5.21 (Berkeley) %G%";
extern char *getenv();
extern char *index();
extern char *rindex();
extern char *getenv();
extern char *index();
extern char *rindex();
+extern char *strerror();
+extern int errno;
extern char reply_string[];
char *mname;
extern char reply_string[];
char *mname;
-/*
- * Set ebcdic transfer type.
- */
-/*VARARGS*/
-setebcdic()
-{
- stype[1] = "ebcdic";
- settype(2, stype);
-}
-
/*
* Set file transfer mode.
*/
/*
* Set file transfer mode.
*/
return;
}
if (chdir(argv[1]) < 0) {
return;
}
if (chdir(argv[1]) < 0) {
+ fprintf(stderr, "local: %s: %s\n", argv[1], strerror(errno));
-static char sccsid[] = "@(#)ftp.c 5.30 (Berkeley) %G%";
+static char sccsid[] = "@(#)ftp.c 5.31 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
uid_t getuid();
sig_t lostpeer();
uid_t getuid();
sig_t lostpeer();
+extern char *strerror();
+extern int errno;
+
FILE *cin, *cout;
FILE *dataconn();
FILE *cin, *cout;
FILE *dataconn();
} else {
fin = fopen(local, "r");
if (fin == NULL) {
} else {
fin = fopen(local, "r");
if (fin == NULL) {
+ fprintf(stderr, "local: %s: %s\n", local,
+ strerror(errno));
(void) signal(SIGINT, oldintr);
code = -1;
return;
(void) signal(SIGINT, oldintr);
code = -1;
return;
(void) fflush(stdout);
}
if (c < 0)
(void) fflush(stdout);
}
if (c < 0)
+ fprintf(stderr, "local: %s: %s\n", local,
+ strerror(errno));
if (d <= 0) {
if (d == 0)
fprintf(stderr, "netout: write returned 0?\n");
if (d <= 0) {
if (d == 0)
fprintf(stderr, "netout: write returned 0?\n");
(void) fflush(stdout);
}
if (ferror(fin))
(void) fflush(stdout);
}
if (ferror(fin))
+ fprintf(stderr, "local: %s: %s\n", local,
+ strerror(errno));
if (ferror(dout)) {
if (errno != EPIPE)
perror("netout");
if (ferror(dout)) {
if (errno != EPIPE)
perror("netout");
char *dir = rindex(local, '/');
if (errno != ENOENT && errno != EACCES) {
char *dir = rindex(local, '/');
if (errno != ENOENT && errno != EACCES) {
+ fprintf(stderr, "local: %s: %s\n", local,
+ strerror(errno));
(void) signal(SIGINT, oldintr);
code = -1;
return;
(void) signal(SIGINT, oldintr);
code = -1;
return;
if (dir != NULL)
*dir = '/';
if (d < 0) {
if (dir != NULL)
*dir = '/';
if (d < 0) {
+ fprintf(stderr, "local: %s: %s\n", local,
+ strerror(errno));
(void) signal(SIGINT, oldintr);
code = -1;
return;
}
if (!runique && errno == EACCES &&
chmod(local, 0600) < 0) {
(void) signal(SIGINT, oldintr);
code = -1;
return;
}
if (!runique && errno == EACCES &&
chmod(local, 0600) < 0) {
+ fprintf(stderr, "local: %s: %s\n", local,
+ strerror(errno));
+ (void) signal(SIGINT, oldintr);
(void) signal(SIGINT, oldintr);
code = -1;
return;
(void) signal(SIGINT, oldintr);
code = -1;
return;
} else {
fout = fopen(local, mode);
if (fout == NULL) {
} else {
fout = fopen(local, mode);
if (fout == NULL) {
+ fprintf(stderr, "local: %s: %s\n", local,
+ strerror(errno));
goto abort;
}
closefunc = fclose;
goto abort;
}
closefunc = fclose;
bytes = -1;
}
if (ferror(fout))
bytes = -1;
}
if (ferror(fout))
+ fprintf(stderr, "local: %s: %s\n", local,
+ strerror(errno));
break;
}
if (closefunc != NULL)
break;
}
if (closefunc != NULL)
if (cp)
*cp = '/';
if (d < 0) {
if (cp)
*cp = '/';
if (d < 0) {
+ fprintf(stderr, "local: %s: %s\n", local, strerror(errno));
return((char *) 0);
}
(void) strcpy(new, local);
return((char *) 0);
}
(void) strcpy(new, local);