]> diplodocus.org Git - nmh/blobdiff - uip/popsbr.c
inc/test-eom-align: Replace case on $MBOX_TYPE with interpolation.
[nmh] / uip / popsbr.c
index de9cafbd3ca02f09c5cb67cc4659658d799bc44d..d79c8b3d2f628bfbefb5fd4a8139b284c752c181 100644 (file)
@@ -12,7 +12,7 @@
 
 #include <h/popsbr.h>
 #include <h/signals.h>
 
 #include <h/popsbr.h>
 #include <h/signals.h>
-#include "../sbr/base64.h"
+#include "sbr/base64.h"
 
 #define        TRM     "."
 
 
 #define        TRM     "."
 
@@ -56,23 +56,16 @@ check_mech(char *server_mechs, size_t server_mechs_size)
        return NOTOK;
     }
 
        return NOTOK;
     }
 
-    while ((status = multiline()) != DONE)
-       switch (status) {
-       case NOTOK:
+    while ((status = multiline()) != DONE) {
+        if (status == NOTOK)
            return NOTOK;
            return NOTOK;
-           break;
-       case DONE:      /* Shouldn't be possible, but just in case */
-           break;
-       case OK:
-           if (strncasecmp(response, "SASL ", 5) == 0) {
-               /*
-                * We've seen the SASL capability.  Grab the mech list
-                */
-               sasl_capability++;
-               strncpy(server_mechs, response + 5, server_mechs_size);
-           }
-           break;
-       }
+
+        if (strncasecmp(response, "SASL ", 5) == 0) {
+            /* We've seen the SASL capability.  Grab the mech list. */
+            sasl_capability++;
+            strncpy(server_mechs, response + 5, server_mechs_size);
+        }
+    }
 
     if (!sasl_capability) {
        snprintf(response, sizeof(response), "POP server does not support "
 
     if (!sasl_capability) {
        snprintf(response, sizeof(response), "POP server does not support "
@@ -115,7 +108,7 @@ parse_proxy(char *proxy, char *host)
 
    /* put together list of arguments */
     p = pargv = mh_xmalloc(pargc * sizeof(char *));
 
    /* put together list of arguments */
     p = pargv = mh_xmalloc(pargc * sizeof(char *));
-    c = *pargv = mh_xmalloc(plen * sizeof(char));
+    c = *pargv = mh_xmalloc(plen);
     for (cur = pro; *cur; cur++) {
         if (isspace(*cur) && cur[1] && !isspace(cur[1])) {
            *c++ = '\0';
     for (cur = pro; *cur; cur++) {
         if (isspace(*cur) && cur[1] && !isspace(cur[1])) {
            *c++ = '\0';
@@ -189,7 +182,7 @@ pop_init (char *host, char *port, char *user, char *proxy, int snoop,
           close(1);
           free(*argv);
           free(argv);
           close(1);
           free(*argv);
           free(argv);
-          exit(10);
+          exit(1);
        }
 
        /* okay in the parent we do some stuff */
        }
 
        /* okay in the parent we do some stuff */
@@ -277,8 +270,10 @@ pop_init (char *host, char *port, char *user, char *proxy, int snoop,
 
        case NOTOK: 
        case DONE: 
 
        case NOTOK: 
        case DONE: 
-           if (poprint)            
-               fprintf (stderr, "%s\n", response);
+           if (poprint) {
+               fputs(response, stderr);
+                putc('\n', stderr);
+            }
            netsec_shutdown(nsc);
            nsc = NULL;
            return NOTOK;
            netsec_shutdown(nsc);
            nsc = NULL;
            return NOTOK;
@@ -599,12 +594,14 @@ vcommand (const char *fmt, va_list ap)
        case OK: 
            if (poprint)
                fprintf (stderr, "<--- %s\n", response);
        case OK: 
            if (poprint)
                fprintf (stderr, "<--- %s\n", response);
-           return (*response == '+' ? OK : NOTOK);
+           return *response == '+' ? OK : NOTOK;
 
        case NOTOK: 
        case DONE: 
 
        case NOTOK: 
        case DONE: 
-           if (poprint)            
-               fprintf (stderr, "%s\n", response);
+           if (poprint) {
+               fputs(response, stderr);
+                putc('\n', stderr);
+            }
            return NOTOK;
     }
 
            return NOTOK;
     }