2 * trimcpy.c -- strip leading and trailing whitespace,
3 * -- replace internal whitespace with spaces,
4 * -- then return a copy.
6 * This code is Copyright (c) 2002, by the authors of nmh. See the
7 * COPYRIGHT file in the root directory of the nmh distribution for
8 * complete copyright information.
15 trimcpy (unsigned char *cp)
19 /* skip over leading whitespace */
23 /* start at the end and zap trailing whitespace */
24 for (sp = cp + strlen(cp) - 1; sp >= cp; sp--) {
31 /* replace remaining whitespace with spaces */
32 for (sp = cp; *sp; sp++) {
37 /* now return a copy */