* complete copyright information.
*/
-#include <h/nmh.h>
-#include <h/utils.h>
+#include "h/mh.h"
+#include "escape_addresses.h"
+#include "h/utils.h"
-static void
-escape_component (char *name, size_t namesize, char *chars);
+static void escape_component (char *name, size_t namesize, char *chars);
void
-escape_display_name (char *name, size_t namesize) {
+escape_display_name (char *name, size_t namesize)
+{
char *specials = "\"(),.:;<>@[\\]";
escape_component (name, namesize, specials);
}
void
-escape_local_part (char *name, size_t namesize) {
+escape_local_part (char *name, size_t namesize)
+{
/* wsp (whitespace) is horizontal tab or space, according to
RFC 5234. */
char *specials_less_dot_plus_wsp = " \"(),:;<>@[\\]";
argument is modified in place. Its size is specified by the
namesize argument. The need_escape argument is a string of
characters that require that name be escaped. */
-void
-escape_component (char *name, size_t namesize, char *chars_to_escape) {
+static void
+escape_component (char *name, size_t namesize, char *chars_to_escape)
+{
/* If name contains any chars_to_escape:
1) enclose it in ""
2) escape any embedded "
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);