1: /* trimcpy.c - strip [lt]wsp and replace newlines with spaces */ 2: 3: #include "../h/mh.h" 4: #include <ctype.h> 5: #include <stdio.h> 6: 7: 8: char *trimcpy (cp) 9: register char *cp; 10: { 11: register char *sp; 12: 13: while (isspace (*cp)) 14: cp++; 15: for (sp = cp + strlen (cp) - 1; sp >= cp; sp--) 16: if (isspace (*sp)) 17: *sp = NULL; 18: else 19: break; 20: for (sp = cp; *sp; sp++) 21: if (isspace (*sp)) 22: *sp = ' '; 23: 24: return getcpy (cp); 25: }