if(len > 2) {
/* Find the start of the message */
len -= 2;
- for(message += 2; *message == ' ' || *message == '\t'; message++, len--)
+ for(message += 2; ISBLANK(*message); message++, len--)
;
/* Find the end of the message */
while(len--)
- if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
- message[len] != '\t')
+ if(!ISNEWLINE(message[len]) && !ISBLANK(message[len]))
break;
/* Terminate the message */
/* Loop through the data line */
for(;;) {
size_t wordlen;
- while(*line &&
- (*line == ' ' || *line == '\t' ||
- *line == '\r' || *line == '\n')) {
-
+ while(*line && (ISBLANK(*line) || ISNEWLINE(*line)))
line++;
- }
if(!*line)
break;
/* Extract the word */
- for(wordlen = 0; line[wordlen] && line[wordlen] != ' ' &&
- line[wordlen] != '\t' && line[wordlen] != '\r' &&
- line[wordlen] != '\n';)
+ for(wordlen = 0; line[wordlen] && !ISBLANK(line[wordlen]) &&
+ !ISNEWLINE(line[wordlen]);)
wordlen++;
/* Does the server support the STARTTLS capability? */
if(len > 2) {
/* Find the start of the message */
len -= 2;
- for(message += 2; *message == ' ' || *message == '\t'; message++, len--)
+ for(message += 2; ISBLANK(*message); message++, len--)
;
/* Find the end of the message */
while(len--)
- if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
- message[len] != '\t')
+ if(!ISBLANK(message[len]) && !ISNEWLINE(message[len]))
break;
/* Terminate the message */
if(len > 4) {
/* Find the start of the message */
len -= 4;
- for(message += 4; *message == ' ' || *message == '\t'; message++, len--)
+ for(message += 4; ISBLANK(*message); message++, len--)
;
/* Find the end of the message */
while(len--)
- if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
- message[len] != '\t')
+ if(!ISNEWLINE(message[len]) && !ISBLANK(message[len]))
break;
/* Terminate the message */
size_t wordlen;
unsigned short mechbit;
- while(len &&
- (*line == ' ' || *line == '\t' ||
- *line == '\r' || *line == '\n')) {
-
+ while(len && (ISBLANK(*line) || ISNEWLINE(*line))) {
line++;
len--;
}
break;
/* Extract the word */
- for(wordlen = 0; wordlen < len && line[wordlen] != ' ' &&
- line[wordlen] != '\t' && line[wordlen] != '\r' &&
- line[wordlen] != '\n';)
+ for(wordlen = 0; wordlen < len && !ISBLANK(line[wordlen]) &&
+ !ISNEWLINE(line[wordlen]);)
wordlen++;
/* Test the word for a matching authentication mechanism */