X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/d20cac6971c9e649cc88e6533e7fa1367e488e14..2ecaea82a8f9758da5a38cb5df98fbde188d92ba:/uip/popsbr.c diff --git a/uip/popsbr.c b/uip/popsbr.c index 54fd24ff..54aa3684 100644 --- a/uip/popsbr.c +++ b/uip/popsbr.c @@ -15,7 +15,6 @@ #include #define TRM "." -#define TRMLEN (sizeof TRM - 1) static int poprint = 0; @@ -434,7 +433,7 @@ pop_sasl_callback(enum sasl_message_type mtype, unsigned const char *indata, if (line == NULL) return NOTOK; - if (strncmp(line, "+OK", 3) != 0) { + if (!HasPrefix(line, "+OK")) { netsec_err(errstr, "Authentication failed: %s", line); return NOTOK; } @@ -686,14 +685,14 @@ vcommand (const char *fmt, va_list ap) int multiline (void) { - char buffer[BUFSIZ + TRMLEN]; + char buffer[BUFSIZ + LEN(TRM)]; if (pop_getline (buffer, sizeof buffer, nsc) != OK) return NOTOK; - if (strncmp (buffer, TRM, TRMLEN) == 0) { - if (buffer[TRMLEN] == 0) + if (HasPrefix(buffer, TRM)) { + if (buffer[LEN(TRM)] == 0) return DONE; - strncpy (response, buffer + TRMLEN, sizeof(response)); + strncpy (response, buffer + LEN(TRM), sizeof(response)); } else strncpy (response, buffer, sizeof(response));