home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / palmos / pippy-0.6beta-src.tar.gz / pippy-0.6beta-src.tar / pippy-0.6beta-src / src / Palm / libc / memscan.c < prev    next >
C/C++ Source or Header  |  2000-12-21  |  458b  |  29 lines

  1. /*
  2.  *  linux/lib/string.c
  3.  *
  4.  *  Copyright (C) 1991, 1992  Linus Torvalds
  5.  */
  6.  
  7. #include <sys/types.h>
  8. #include <string.h>
  9. #include <ctype.h>
  10.  
  11. /*
  12.  * find the first occurrence of byte 'c', or 1 past the area if none
  13.  */
  14. #ifndef __HAVE_ARCH_MEMSCAN
  15. void * memscan(void * addr, int c, size_t size)
  16. {
  17.   unsigned char * p = (unsigned char *) addr;
  18.  
  19.   while (size) {
  20.     if (*p == c)
  21.       return (void *) p;
  22.     p++;
  23.     size--;
  24.   }
  25.   return (void *) p;
  26. }
  27. #endif
  28.  
  29.