X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/b66f48b0d0caea86ac3ae5e5044e3340be22f1a6..394a751fd883d2bbfc769fed7e254e008a2ef45e:/sbr/trimcpy.c diff --git a/sbr/trimcpy.c b/sbr/trimcpy.c index 50e7142e..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 * @@ -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 */