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

  1. #ifndef NO_IDENT
  2. static char *Id = "$Id: strclip.c,v 1.1 1995/10/22 21:48:56 tom Exp $";
  3. #endif
  4.  
  5. /*
  6.  * Title:    strclip.c
  7.  * Author:    Thomas E. Dickey
  8.  * Created:    22 Oct 1995
  9.  * Last update:
  10.  *
  11.  * Function:    Remove the first occurrence of the given substring from the
  12.  *        argument, returning true if found.
  13.  *
  14.  * Parameters:    inout    = the string to remove from
  15.  *        clip    = the substring to remove
  16.  */
  17.  
  18. #include <string.h>
  19.  
  20. #include "bool.h"
  21. #include "strutils.h"
  22.  
  23. int
  24. strclip (
  25.     char    *inout,
  26.     char    *clip)
  27. {
  28.     char    *found = strstr(inout, clip);
  29.  
  30.     if (found != 0) {
  31.         size_t len = strlen(clip);
  32.         while ((found[0] = found[len]) != EOS)
  33.             found++;
  34.         return TRUE;
  35.     }
  36.     return FALSE;
  37. }
  38.