From 8ea71774750b178647ef11fbe1efed18011bb24f Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 17 Dec 1996 04:00:27 +0000 Subject: Yet morer error message cleanup. svn path=/trunk/; revision=645 --- driver.c | 34 ++++++++++++++++------------------ imap.c | 4 ++-- pop2.c | 2 +- pop3.c | 6 +++--- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/driver.c b/driver.c index 97d6a46e..545dabfc 100644 --- a/driver.c +++ b/driver.c @@ -219,9 +219,7 @@ struct idlist **xmit_names; /* list of recipient names parsed out */ if (lname != (char *)NULL) { if (outlevel == O_VERBOSE) - fprintf(stderr, - "fetchmail: mapped %s to local %s\n", - name, lname); + error(0, 0, "mapped %s to local %s", name, lname); save_str(xmit_names, -1, lname); } } @@ -438,8 +436,8 @@ struct query *ctl; /* query control record */ received_for = alloca(strlen(rbuf)+1); strcpy(received_for, rbuf); if (outlevel == O_VERBOSE) - fprintf(stderr, - "fetchmail: found Received address `%s'\n", + error(0, 0, + "found Received address `%s'", received_for); } } @@ -487,8 +485,8 @@ struct query *ctl; /* query control record */ no_local_matches = TRUE; save_str(&xmit_names, -1, user); if (outlevel == O_VERBOSE) - fprintf(stderr, - "fetchmail: no local matches, forwarding to %s\n", + error(0, 0, + "no local matches, forwarding to %s", user); } } @@ -601,8 +599,6 @@ struct query *ctl; /* query control record */ /* tell it we're ready to send data */ SMTP_data(sinkfp); - if (outlevel == O_VERBOSE) - fputs("SMTP> ", stderr); skiptext:; } @@ -805,7 +801,7 @@ const struct method *proto; /* protocol method table */ #ifndef KERBEROS_V4 if (ctl->authenticate == A_KERBEROS) { - fputs("fetchmail: Kerberos support not linked.\n", stderr); + error(0, 0, "Kerberos support not linked."); return(PS_ERROR); } #endif /* KERBEROS_V4 */ @@ -815,22 +811,22 @@ const struct method *proto; /* protocol method table */ { /* check for unsupported options */ if (ctl->flush) { - fprintf(stderr, - "Option --flush is not supported with %s\n", + error(0, 0, + "Option --flush is not supported with %s", proto->name); return(PS_SYNTAX); } else if (ctl->fetchall) { - fprintf(stderr, - "Option --all is not supported with %s\n", + error(0, 0, + "Option --all is not supported with %s", proto->name); return(PS_SYNTAX); } } if (!proto->getsizes && ctl->limit) { - fprintf(stderr, - "Option --limit is not supported with %s\n", + error(0, 0, + "Option --limit is not supported with %s", proto->name); return(PS_SYNTAX); } @@ -1157,7 +1153,8 @@ va_dcl { if (shroud && (cp = strstr(buf, shroud))) memset(cp, '*', strlen(shroud)); - fprintf(stderr,"> %s", buf); + buf[strlen(buf)-1] = '\0'; + error(0, 0, "> %s", buf); } } @@ -1198,7 +1195,8 @@ va_dcl { if (shroud && (cp = strstr(buf, shroud))) memset(cp, '*', strlen(shroud)); - fprintf(stderr,"> %s", buf); + buf[strlen(buf)-1] = '\0'; + error(0, 0, "> %s", buf); } /* we presume this does its own response echoing */ diff --git a/imap.c b/imap.c index 8d9350a6..fc9634d1 100644 --- a/imap.c +++ b/imap.c @@ -29,7 +29,7 @@ int imap_ok (FILE *sockfp, char *argbuf) return(PS_SOCKET); if (outlevel == O_VERBOSE) - error(0, 0, buf); + error(0, 0, "< %s", buf); /* interpret untagged status responses */ if (strstr(buf, "EXISTS")) @@ -123,7 +123,7 @@ static int imap_getsizes(FILE *sockfp, int count, int *sizes) int num, size; if (outlevel == O_VERBOSE) - error(0, 0, buf); + error(0, 0, "< %s", buf); if (strstr(buf, "OK")) break; else if (sscanf(buf, "* %d FETCH (RFC822.SIZE %d)", &num, &size) == 2) diff --git a/pop2.c b/pop2.c index 1df54b43..3fc40ede 100644 --- a/pop2.c +++ b/pop2.c @@ -25,7 +25,7 @@ int pop2_ok (FILE *sockfp, char *argbuf) pound_arg = equal_arg = -1; if (SockGets(buf, sizeof(buf), sockfp) >= 0) { if (outlevel == O_VERBOSE) - error(0, 0, buf); + error(0, 0, "< %s", buf); if (buf[0] == '+') ok = 0; diff --git a/pop3.c b/pop3.c index d80cb2f1..fac92dc3 100644 --- a/pop3.c +++ b/pop3.c @@ -32,7 +32,7 @@ int pop3_ok (FILE *sockfp, char *argbuf) if (SockGets(buf, sizeof(buf), sockfp) >= 0) { if (outlevel == O_VERBOSE) - error(0, 0, buf); + error(0, 0, "< %s", buf); bufp = buf; if (*bufp == '+' || *bufp == '-') @@ -168,7 +168,7 @@ static int pop3_getrange(FILE *sockfp, struct query *ctl, int*countp, int*newp) while (SockGets(buf, sizeof(buf), sockfp) >= 0) { if (outlevel == O_VERBOSE) - error(0, 0, buf); + error(0, 0, "< %s", buf); if (buf[0] == '.') break; else if (sscanf(buf, "%d %s", &num, id) == 2) @@ -201,7 +201,7 @@ static int pop3_getsizes(FILE *sockfp, int count, int *sizes) int num, size; if (outlevel == O_VERBOSE) - error(0, 0, buf); + error(0, 0, "< %s", buf); if (buf[0] == '.') break; else if (sscanf(buf, "%d %d", &num, &size) == 2) -- cgit v1.2.3