X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Ftrimcpy.c;h=f24563ce73e25ee045a4c79bcb87680eba93279d;hb=b067ff5c465a5d243ce5a19e562085a9a1a97215;hp=c341f00c4abed66e75d32720514fc72f7f0d09fe;hpb=6c42153ad9362cc676ea66563bf400d7511b3b68;p=mmh diff --git a/sbr/trimcpy.c b/sbr/trimcpy.c index c341f00..f24563c 100644 --- a/sbr/trimcpy.c +++ b/sbr/trimcpy.c @@ -1,11 +1,8 @@ - /* * 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. @@ -15,28 +12,28 @@ 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); }