2 ** trim.c -- strip leading and trailing whitespace ... inplace!
4 ** This code is Copyright (c) 2002, by the authors of nmh. See the
5 ** COPYRIGHT file in the root directory of the nmh distribution for
6 ** complete copyright information.
14 trim(unsigned char *cp)
18 /* skip over leading whitespace */
19 while (isspace(*cp)) {
23 /* start at the end and zap trailing whitespace */
24 for (sp = cp + strlen(cp) - 1; sp >= cp; sp--) {
38 char *sp = cp + strlen(cp) - 1;
40 while (sp >= cp && isspace(*sp)) {