summaryrefslogtreecommitdiffstats
path: root/crypto/heimdal/appl/push/push.c
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2003-10-09 19:36:20 +0000
committernectar <nectar@FreeBSD.org>2003-10-09 19:36:20 +0000
commit5c90662d441c12cd30c694eb1172d6fea2f8f282 (patch)
treecb08d962a1d1ff9fd191e67849a7057861f42a50 /crypto/heimdal/appl/push/push.c
parent12eb3dee85137da9effa7d2df35e855dd0a3814a (diff)
downloadFreeBSD-src-5c90662d441c12cd30c694eb1172d6fea2f8f282.zip
FreeBSD-src-5c90662d441c12cd30c694eb1172d6fea2f8f282.tar.gz
Vendor import of Heimdal 0.6.
Diffstat (limited to 'crypto/heimdal/appl/push/push.c')
-rw-r--r--crypto/heimdal/appl/push/push.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/crypto/heimdal/appl/push/push.c b/crypto/heimdal/appl/push/push.c
index 2f051ee..60d1654 100644
--- a/crypto/heimdal/appl/push/push.c
+++ b/crypto/heimdal/appl/push/push.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2001 Kungliga Tekniska Högskolan
+ * Copyright (c) 1997-2001, 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -32,7 +32,7 @@
*/
#include "push_locl.h"
-RCSID("$Id: push.c,v 1.45 2001/09/04 09:45:52 assar Exp $");
+RCSID("$Id: push.c,v 1.47 2003/04/04 02:10:17 assar Exp $");
#ifdef KRB4
static int use_v4 = -1;
@@ -137,6 +137,11 @@ do_connect (const char *hostname, int port, int nodelay)
typedef enum { INIT = 0, GREET, USER, PASS, STAT, RETR, TOP,
DELE, XDELE, QUIT} pop_state;
+static char *pop_state_string[] = {
+ "INIT", "GREET", "USER", "PASS", "STAT", "RETR", "TOP",
+ "DELE", "XDELE", "QUIT"
+};
+
#define PUSH_BUFSIZ 65536
#define STEP 16
@@ -267,7 +272,7 @@ doit(int s,
if (net_write (s, out_buf, out_len) != out_len)
err (1, "write");
if (verbose > 1)
- write (STDERR_FILENO, out_buf, out_len);
+ fprintf (stderr, "%s", out_buf);
if (!do_from)
write_state_init (&write_state, out_fd);
@@ -280,6 +285,13 @@ doit(int s,
if (s >= FD_SETSIZE)
errx (1, "fd too large");
FD_SET(s,&readset);
+
+ if (verbose > 1)
+ fprintf (stderr, "state: %s count: %d asked_for: %d "
+ "retrieved: %d asked_deleted: %d\n",
+ pop_state_string[state],
+ count, asked_for, retrieved, asked_deleted);
+
if (((state == STAT || state == RETR || state == TOP)
&& asked_for < count)
|| (state == XDELE && !sent_xdele)
@@ -331,7 +343,7 @@ doit(int s,
state = QUIT;
net_write (s, "QUIT\r\n", 6);
if (verbose > 1)
- net_write (STDERR_FILENO, "QUIT\r\n", 6);
+ fprintf (stderr, "QUIT\r\n");
}
}
rem -= p - beg + 2;
@@ -354,7 +366,7 @@ doit(int s,
state = QUIT;
net_write (s, "QUIT\r\n", 6);
if (verbose > 1)
- net_write (STDERR_FILENO, "QUIT\r\n", 6);
+ fprintf (stderr, "QUIT\r\n");
} else {
if (forkp) {
pid_t pid;
@@ -401,14 +413,14 @@ doit(int s,
state = QUIT;
net_write (s, "QUIT\r\n", 6);
if (verbose > 1)
- net_write (STDERR_FILENO, "QUIT\r\n", 6);
+ fprintf (stderr, "QUIT\r\n");
break;
} else if (state == DELE) {
if (++deleted == count) {
state = QUIT;
net_write (s, "QUIT\r\n", 6);
if (verbose > 1)
- net_write (STDERR_FILENO, "QUIT\r\n", 6);
+ fprintf (stderr, "QUIT\r\n");
break;
}
} else if (++state == STAT) {
@@ -428,7 +440,7 @@ doit(int s,
state = QUIT;
net_write (s, "QUIT\r\n", 6);
if (verbose > 1)
- net_write (STDERR_FILENO, "QUIT\r\n", 6);
+ fprintf (stderr, "QUIT\r\n");
break;
}
}
@@ -471,7 +483,7 @@ doit(int s,
if (net_write (s, out_buf, out_len) != out_len)
err (1, "write");
if (verbose > 1)
- write (STDERR_FILENO, out_buf, out_len);
+ fprintf (stderr, "%s", out_buf);
}
}
if (verbose)
OpenPOWER on IntegriCloud