From f0abcb4154dc21dd382e948d5033a4bed2a04673 Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Thu, 22 Aug 1996 23:25:24 +0000 Subject: [PATCH] Print the correct thing when interrupted by a signal. --- usr.bin/fetch/main.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/usr.bin/fetch/main.c b/usr.bin/fetch/main.c index 5e5f998b2e8..868a410eb7a 100644 --- a/usr.bin/fetch/main.c +++ b/usr.bin/fetch/main.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. */ -/* $Id: main.c,v 1.16 1996/08/21 01:27:25 jkh Exp $ */ +/* $Id: main.c,v 1.17 1996/08/22 21:30:51 jkh Exp $ */ #include #include @@ -94,10 +94,10 @@ die(int sig) int e = errno; rm(); - if (errno) + if (!sig) fprintf (stderr, "%s: %s\n", progname, sys_errlist[e]); else - fprintf (stderr, "%s: Interrupted by signal\n", progname); + fprintf (stderr, "%s: Interrupted by signal %d\n", progname, sig); exit(1); } @@ -537,11 +537,10 @@ ftperr (FILE* ftp, char *fmt, ...) if (fmt) vfprintf(stderr, fmt, ap); if(ftp) { - switch (ftpErrno(ftp)) { - case 421: fprintf (stderr, "Service not available\n"); break; - case 450: fprintf (stderr, "File not available\n"); break; - case 550: fprintf (stderr, "No such file or directory\n"); break; - } + const char *str = ftpErrString(ftpErrno(ftp)); + + if (str) + fprintf(stderr, "%s\n", str); } rm (); exit (1);