3 * trimcpy.c -- strip leading and trailing whitespace,
4 * -- replace internal whitespace with spaces,
5 * -- then return a copy.
9 * This code is Copyright (c) 2002, by the authors of nmh. See the
10 * COPYRIGHT file in the root directory of the nmh distribution for
11 * complete copyright information.
18 trimcpy (unsigned char *cp)
22 /* skip over leading whitespace */
26 /* start at the end and zap trailing whitespace */
27 for (sp = cp + strlen(cp) - 1; sp >= cp; sp--) {
34 /* replace remaining whitespace with spaces */
35 for (sp = cp; *sp; sp++) {
40 /* now return a copy */