home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / find-3.8-src.lha / src / amiga / find-3.8 / lib / strspn.c < prev    next >
C/C++ Source or Header  |  1992-11-24  |  1KB  |  35 lines

  1. /* strspn.c -- return numbers of chars at start of string in a class
  2.    Copyright (C) 1987, 1990 Free Software Foundation, Inc.
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 2, or (at your option)
  7.    any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. #if defined(HAVE_STRING_H)
  19. #include <string.h>
  20. #define index strchr
  21. #else
  22. #include <strings.h>
  23. #endif
  24.  
  25. int
  26. strspn (str, class)
  27.      char *str, *class;
  28. {
  29.   register char *st = str;
  30.  
  31.   while (*st && index (class, *st))
  32.     ++st;
  33.   return st - str;
  34. }
  35.