Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/ape-memchr/memchr.c.orig

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include	<string.h>

void*
memchr(const void *ap, int c, size_t n)
{
	char *sp;

	sp = ap;
	while(n > 0) {
		if(*sp++ == c)
			return sp-1;
		n--;
	}
	return 0;
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.