]> diplodocus.org Git - nmh/blobdiff - sbr/escape_addresses.c
Changed failure exit status of mkstemp(1) from 255 to 1.
[nmh] / sbr / escape_addresses.c
index 0d898dbd87bb5a51db5362e37bd66a723e559e0b..11a4faa33e7fb1ee0bf8b24d333145240044ea26 100644 (file)
@@ -5,7 +5,7 @@
  * complete copyright information.
  */
 
-#include <h/nmh.h>
+#include <h/mh.h>
 #include <h/utils.h>
 
 static void
@@ -42,7 +42,7 @@ escape_component (char *name, size_t namesize, char *chars_to_escape) {
     if (strpbrk(name, chars_to_escape)) {
         char *destp, *srcp;
         /* Maximum space requirement would be if each character had
-           to be escaped, plus enclosing double quotes, plus null termintor.
+           to be escaped, plus enclosing double quotes, plus NUL terminator.
            E.g., 2 characters, "", would require 7, "\"\""0, where that 0
            is '\0'. */
         char *tmp = mh_xmalloc (2*strlen(name) + 3);
@@ -76,7 +76,7 @@ escape_component (char *name, size_t namesize, char *chars_to_escape) {
         if (strcmp (tmp, "\"")) {
             size_t len = destp - tmp;
             assert ((ssize_t) strlen(tmp) + 1 == destp - tmp);
-            strncpy (name, tmp, len <= namesize  ?  len  :  namesize);
+            strncpy (name, tmp, min(len, namesize));
         } else {
             /* Handle just " as special case here instead of above. */
             strncpy (name, "\"\\\"\"", namesize);