home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / flistfrontend / src / strtrim.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-06  |  657 b   |  35 lines

  1. #ifndef    NO_IDENT
  2. static    char    *Id = "$Id: strtrim.c,v 1.4 1995/06/06 13:41:18 tom Exp $";
  3. #endif
  4.  
  5. /*
  6.  * Title:    strtrim
  7.  * Author:    Thomas E. Dickey
  8.  * Created:    11 Aug 1983
  9.  * Last update:
  10.  *        18 Feb 1995, prototypes
  11.  *
  12.  * Function:    This procedure trims trailing "blank" characters from a null-
  13.  *        ended ASCII string, by replacing the blanks with nulls.
  14.  *
  15.  * Parameters:    c_     => string to trim
  16.  *
  17.  * Returns:    The length of the string after trimming it.
  18.  */
  19.  
  20. #include    <ctype.h>
  21. #include    <string.h>
  22.  
  23. #include    "strutils.h"
  24.  
  25. int
  26. strtrim (char *c_)
  27. {
  28.     int    len;
  29.  
  30.     for (len = strlen(c_--);
  31.         (len > 0) && isspace(*(c_+len));
  32.             *(c_+len--) = '\0');
  33.     return (len);
  34. }
  35.