home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / compiler / small_c / cb / sources / trim.c < prev    next >
Encoding:
Text File  |  1985-07-22  |  256 b   |  12 lines

  1. /*
  2. ** trim -- trim \n from str & return its length
  3. */
  4. trim(str) char *str; {
  5.   char *s;
  6.   s = str - 1;
  7.   while(*++s) ;  /* prefix ++ is faster */
  8.   if((*--s == '\n') && (s >= str)) *s = NULL; else ++s;
  9.   return (s - str);
  10.   }
  11.  
  12.