Add %(unmailto) format function for List-Post headers
[mmh] / sbr / trimcpy.c
index 8b57ad6..ffa6b57 100644 (file)
@@ -1,42 +1,41 @@
-
 /*
- * trimcpy.c -- strip leading and trailing whitespace,
- *           -- replace internal whitespace with spaces,
- *           -- then return a copy.
- *
- * $Id$
- *
- * This code is Copyright (c) 2002, by the authors of nmh.  See the
- * COPYRIGHT file in the root directory of the nmh distribution for
- * complete copyright information.
- */
+** trimcpy.c -- strip leading and trailing whitespace,
+**           -- replace internal whitespace with spaces,
+**           -- then return a copy.
+**
+** This code is Copyright (c) 2002, by the authors of nmh.  See the
+** COPYRIGHT file in the root directory of the nmh distribution for
+** complete copyright information.
+*/
 
 #include <h/mh.h>
+#include <h/utils.h>
+#include <ctype.h>
 
 
 char *
-trimcpy (unsigned char *cp)
+trimcpy(unsigned char *cp)
 {
-    unsigned char *sp;
-
-    /* skip over leading whitespace */
-    while (isspace(*cp))
-       cp++;
-
-    /* start at the end and zap trailing whitespace */
-    for (sp = cp + strlen(cp) - 1; sp >= cp; sp--) {
-       if (isspace(*sp))
-           *sp = '\0';
-       else
-           break;
-    }
-
-    /* replace remaining whitespace with spaces */
-    for (sp = cp; *sp; sp++) {
-       if (isspace(*sp))
-           *sp = ' ';
-    }
-
-    /* now return a copy */
-    return getcpy(cp);
+       unsigned char *sp;
+
+       /* skip over leading whitespace */
+       while (isspace(*cp))
+               cp++;
+
+       /* start at the end and zap trailing whitespace */
+       for (sp = cp + strlen(cp) - 1; sp >= cp; sp--) {
+               if (isspace(*sp))
+                       *sp = '\0';
+               else
+                       break;
+       }
+
+       /* replace remaining whitespace with spaces */
+       for (sp = cp; *sp; sp++) {
+               if (isspace(*sp))
+                       *sp = ' ';
+       }
+
+       /* now return a copy */
+       return mh_xstrdup(cp);
 }