src/mime.c
author Krista 'DarthMama' Bennett <krista@pep.foundation>
Thu, 04 Jun 2020 11:18:45 +0200
changeset 4729 3df9a2a67597
parent 4591 fbaa9d61a265
permissions -rw-r--r--
forgot test files
     1 // This file is under GNU General Public License 3.0
     2 // see LICENSE.txt
     3 
     4 #define _EXPORT_PEP_ENGINE_DLL
     5 #include "mime.h"
     6 
     7 #include <string.h>
     8 #include <stdlib.h>
     9 #include <assert.h>
    10 #include <errno.h>
    11 
    12 static bool is_whitespace(char c)
    13 {
    14     switch (c) {
    15         case ' ':
    16         case '\t':
    17         case '\r':
    18         case '\n':
    19             return true;
    20 
    21         default:
    22             return false;
    23     }
    24 }
    25 
    26 DYNAMIC_API bool is_PGP_message_text(const char *text)
    27 {
    28     if (text == NULL)
    29         return false;
    30 
    31     for (; *text && is_whitespace(*text); text++);
    32 
    33     return strncmp(text, "-----BEGIN PGP MESSAGE-----", 27) == 0;
    34 }