home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / RMALLWS.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  939b  |  43 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  Originally published as part of the MicroFirm Function Library
  5. **
  6. **  Copyright 1986, S.E. Margison
  7. **  Copyright 1989, Robert B.Stout
  8. **
  9. **  The user is granted a free limited license to use this source file
  10. **  to create royalty-free programs, subject to the terms of the
  11. **  license restrictions specified in the LICENSE.MFL file.
  12. **
  13. **  remove all whitespace from a string
  14. */
  15.  
  16. #include <stdio.h>
  17. #include <ctype.h>
  18. #include "snip_str.h"
  19.  
  20. #if defined(__cplusplus) && __cplusplus
  21.  extern "C" {
  22. #endif
  23.  
  24. char *rmallws(char *str)
  25. {
  26.       char *obuf, *nbuf;
  27.  
  28.       if (str)
  29.       {
  30.             for (obuf = str, nbuf = str; *obuf; ++obuf)
  31.             {
  32.                   if (!isspace(*obuf))
  33.                         *nbuf++ = *obuf;
  34.             }
  35.             *nbuf = NUL;
  36.       }
  37.       return str;
  38. }
  39.  
  40. #if defined(__cplusplus) && __cplusplus
  41.  }
  42. #endif
  43.