Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / sbr / trimcpy.c
1 /* trimcpy.c - strip [lt]wsp and replace newlines with spaces */
2 #ifndef       lint
3 static char ident[] = "@(#)$Id: trimcpy.c,v 1.3 1992/12/15 00:20:22 jromine Exp $";
4 #endif  /*        lint */
5
6
7 #include "../h/mh.h"
8 #include <ctype.h>
9 #include <stdio.h>
10
11
12 char *trimcpy (cp)
13 register char *cp;
14 {
15     register char  *sp;
16
17     while (isspace (*cp))
18         cp++;
19     for (sp = cp + strlen (cp) - 1; sp >= cp; sp--)
20         if (isspace (*sp))
21             *sp = 0;
22         else
23             break;
24     for (sp = cp; *sp; sp++)
25         if (isspace (*sp))
26             *sp = ' ';
27
28     return getcpy (cp);
29 }