X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/ea0a6d8112a918809bd03d8126411040d22f2bb8..d9c88cd101a63778a85dfd55a01a3af0db2465c9:/sbr/trimcpy.c diff --git a/sbr/trimcpy.c b/sbr/trimcpy.c index 7a2ac03a..09b6ec34 100644 --- a/sbr/trimcpy.c +++ b/sbr/trimcpy.c @@ -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,9 @@ * complete copyright information. */ -#include -#include +#include "h/mh.h" +#include "trimcpy.h" +#include "h/utils.h" char * @@ -37,7 +36,7 @@ trimcpy (char *cp) } /* now return a copy */ - return getcpy(cp); + return mh_xstrdup(cp); } @@ -51,14 +50,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 +83,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 */