strncasecmp(3)
authorvb
Tue, 03 Mar 2015 11:44:59 +0100
changeset 856fd10806c186
parent 84 2009f3090d32
child 86 0e08645f7230
strncasecmp(3)
src/keymanagement.c
src/message_api.c
src/platform_windows.h
     1.1 --- a/src/keymanagement.c	Tue Mar 03 11:04:40 2015 +0100
     1.2 +++ b/src/keymanagement.c	Tue Mar 03 11:44:59 2015 +0100
     1.3 @@ -1,4 +1,4 @@
     1.4 -#ifndef WIN32 // UNIX
     1.5 +#ifndef WIN32 // POSIX
     1.6  #define _POSIX_C_SOURCE 200809L
     1.7  #else
     1.8  #include "platform_windows.h"
     2.1 --- a/src/message_api.c	Tue Mar 03 11:04:40 2015 +0100
     2.2 +++ b/src/message_api.c	Tue Mar 03 11:44:59 2015 +0100
     2.3 @@ -2,6 +2,13 @@
     2.4  #include "keymanagement.h"
     2.5  #include "mime.h"
     2.6  
     2.7 +#ifndef WIN32 // POSIX
     2.8 +#define _POSIX_C_SOURCE 200809L
     2.9 +#include <strings.h>
    2.10 +#else
    2.11 +#include "platform_windows.h"
    2.12 +#endif
    2.13 +
    2.14  #include <assert.h>
    2.15  #include <string.h>
    2.16  #include <stdlib.h>
    2.17 @@ -22,7 +29,7 @@
    2.18      if (ptext == NULL)
    2.19          return NULL;
    2.20  
    2.21 -    strcpy(ptext, "subject: ");
    2.22 +    strcpy(ptext, "Subject: ");
    2.23      strcat(ptext, shortmsg);
    2.24      strcat(ptext, "\n\n");
    2.25      strcat(ptext, longmsg);
    2.26 @@ -42,7 +49,7 @@
    2.27      *shortmsg = NULL;
    2.28      *longmsg = NULL;
    2.29  
    2.30 -    if (strncmp(src, "subject: ", 9) == 0) {
    2.31 +    if (strncasecmp(src, "subject: ", 9) == 0) {
    2.32          char *line_end = strchr(src, '\n');
    2.33          
    2.34          if (line_end == NULL) {
    2.35 @@ -425,12 +432,8 @@
    2.36  
    2.37      switch (enc_format) {
    2.38          case PEP_enc_none:
    2.39 -            if (src->enc_format == PEP_enc_PEP) {
    2.40 -                // TODO: implement
    2.41 -                NOT_IMPLEMENTED
    2.42 -            }
    2.43 -
    2.44 -            break;
    2.45 +            // TODO: implement
    2.46 +            NOT_IMPLEMENTED
    2.47  
    2.48          case PEP_enc_none_MIME:
    2.49              if (src->enc_format == PEP_enc_PEP) {
     3.1 --- a/src/platform_windows.h	Tue Mar 03 11:04:40 2015 +0100
     3.2 +++ b/src/platform_windows.h	Tue Mar 03 11:44:59 2015 +0100
     3.3 @@ -22,7 +22,9 @@
     3.4  #ifndef strtok_r
     3.5  #define strtok_r(A, B, C) strtok_s((A), (B), (C))
     3.6  #endif
     3.7 -
     3.8 +#ifndef strncasecmp
     3.9 +#define strncasecmp(A, B, C) _strnicmp((A), (B), (C))
    3.10 +#endif
    3.11  char *strndup(const char *s1, size_t n);
    3.12  
    3.13  const char *windoze_local_db(void);