simplify pop_query further.
authorPierre Habouzit <madcoder@debian.org>
Tue, 15 May 2007 07:55:06 +0000 (09:55 +0200)
committerPierre Habouzit <madcoder@debian.org>
Tue, 15 May 2007 07:55:06 +0000 (09:55 +0200)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
pop.c

diff --git a/pop.c b/pop.c
index ea0cb8c..3cfb694 100644 (file)
--- a/pop.c
+++ b/pop.c
@@ -105,16 +105,12 @@ static void pop_error(pop_data_t *pop_data, const char *msg)
 */
 static pop_query_status _pop_query(pop_data_t *pop_data, char *buf, ssize_t buflen)
 {
-    char *c;
-
     if (pop_data->status != POP_CONNECTED)
         return PQ_NOT_CONNECTED;
 
     mutt_socket_write(pop_data->conn, buf);
-
-    c  = strpbrk(buf, " \r\n");
-    *c = '\0';
-    snprintf(pop_data->err_msg, sizeof(pop_data->err_msg), "%s: ", buf);
+    snprintf(pop_data->err_msg, sizeof(pop_data->err_msg), "%.*s: ",
+             (int)(strpbrk(buf, " \r\n") - buf), buf);
 
     if (mutt_socket_readln(buf, buflen, pop_data->conn) < 0) {
         pop_data->status = POP_DISCONNECTED;