/* * t r i m . c */ /*)LIBRARY */ #ifdef DOCUMENTATION title trim Trim Trailing Whitespace From a String index Trim trailing whitespace from a string synopsis trim(s) char s[]; description trim() trims all trailing whitespace from the string passed. Note that the actual string passed is modified. "Whitespace-ness" is determined by the function isspace(). bugs author Jerry Leichter #endif /* *)EDITLEVEL=03 * Edit history * 0.0 19-May-81 JSL Invention * 1.0 14-Jul-82 JSL iswhite() ==> isspace() */ #define EOS '\0' trim(s) char s[]; { register char *p; register int lim; for (p=s+(lim = strlen(s)); isspace(*--p) && --lim >= 0; ) ; *(p+1) = EOS; return; }