compiler/clib: Rename IoErr2errno() to __arosc_ioerr2errno(); function is now defined...
[AROS.git] / compiler / clib / memchr.c
blob7ff9ce8b56a53edeca68d96bc12e85c096ca98f8
1 /*
2 Copyright © 1995-2009, The AROS Development Team. All rights reserved.
3 $Id$
5 ANSI C function memchr().
6 */
8 /*****************************************************************************
10 NAME */
11 #include <string.h>
13 void * memchr (
15 /* SYNOPSIS */
16 const void * mem,
17 int c,
18 size_t n)
20 /* FUNCTION
21 Locate the first occurence of c which is converted to an unsigned
22 char in the first n bytes of the memory pointed to by mem.
24 INPUTS
25 mem - pointer to memory that is searched for c
26 c - the character to search for
27 n - how many bytes to search through starting at mem
29 RESULT
30 pointer to the located byte or null if c was not found
32 NOTES
34 EXAMPLE
36 BUGS
38 SEE ALSO
40 INTERNALS
42 ******************************************************************************/
44 /* unsigned char to compare chars > 127 */
45 const unsigned char * ptr = (unsigned char *)mem;
47 while (n)
49 if (*ptr == (unsigned char)c)
50 return ((void *)ptr);
52 n --;
53 ptr ++;
56 return NULL;
57 } /* memchr */