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

  1. #ifndef NO_IDENT
  2. static char *Id = "$Id: strvcpy.c,v 1.3 1995/02/19 18:33:08 tom Exp $";
  3. #endif
  4.  
  5. /*
  6.  * Title:    strvcpy.c
  7.  * Author:    Thomas E. Dickey
  8.  * Created:    05 Nov 1984
  9.  * Last update:
  10.  *        19 Feb 1995, prototyped
  11.  *
  12.  * Function:    Copy a string, making it uppercase, with no more than one
  13.  *        blank in a row.  All blanks are replaced by the space
  14.  *        character.
  15.  *
  16.  * Arguments:    co_    => output string
  17.  *        ci_    => input string.  If null, assume 'co_'.
  18.  */
  19.  
  20. #include    <ctype.h>
  21.  
  22. #include    "strutils.h"
  23.  
  24. void
  25. strvcpy (char *co_, char *ci_)
  26. {
  27.     register
  28.     char    c = ' ', d = '?';
  29.  
  30.     if (!ci_)    ci_ = co_;
  31.     do {
  32.         c = toascii(*ci_);
  33.         c = _toupper(c);
  34.         ci_++;
  35.         if (isspace(c))
  36.         {
  37.             if (!isspace(d))    *co_++ = ' ';
  38.         }
  39.         else
  40.             *co_++ = c;
  41.         d = c;
  42.     } while (c);
  43. }
  44.