]> diplodocus.org Git - nmh/blobdiff - sbr/trimcpy.c
path.c: Move interface to own file.
[nmh] / sbr / trimcpy.c
index 7a2ac03abecf05f4553a7511cb39393b7287b300..6ed00b992079f883b2cb454f43d149b761a51076 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * trimcpy.c -- strip leading and trailing whitespace,
+/* trimcpy.c -- strip leading and trailing whitespace,
  *           -- replace internal whitespace with spaces,
  *           -- then return a copy.
  *
@@ -9,8 +7,8 @@
  * complete copyright information.
  */
 
-#include <h/mh.h>
-#include <h/utils.h>
+#include "h/mh.h"
+#include "h/utils.h"
 
 
 char *
@@ -37,7 +35,7 @@ trimcpy (char *cp)
     }
 
     /* now return a copy */
-    return getcpy(cp);
+    return mh_xstrdup(cp);
 }
 
 
@@ -51,14 +49,15 @@ trimcpy (char *cp)
  * complete copyright information.
  */
 char *
-cpytrim (const char *sp) {
+cpytrim (const char *sp)
+{
     char *dp;
     char *cp;
 
     /* skip over leading whitespace */
     while (isspace ((unsigned char) *sp)) ++sp;
 
-    dp = add (sp, NULL);
+    dp = mh_xstrdup(sp);
 
     /* start at the end and zap trailing whitespace */
     for (cp = dp + strlen (dp) - 1;
@@ -83,7 +82,8 @@ cpytrim (const char *sp) {
  * complete copyright information.
  */
 char *
-rtrim (char *sp) {
+rtrim (char *sp)
+{
     char *cp;
 
     /* start at the end and zap trailing whitespace */