X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Ftrimcpy.c;h=0d7f58a8190b2b373a3e98865e9753b9aa32343d;hp=d13554850c9e0939807bad6c79d11e0400e2f9fb;hb=4dc39c08f07428ff5f39acd7b0ddee30e0a004f6;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b diff --git a/sbr/trimcpy.c b/sbr/trimcpy.c index d135548..0d7f58a 100644 --- a/sbr/trimcpy.c +++ b/sbr/trimcpy.c @@ -1,38 +1,40 @@ - /* - * trimcpy.c -- strip leading and trailing whitespace, - * -- replace internal whitespace with spaces, - * -- then return a copy. - * - * $Id$ - */ +** 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 +#include char * -trimcpy (char *cp) +trimcpy(unsigned char *cp) { - 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 getcpy(cp); }