diff options
Diffstat (limited to 'libc/misc/lsearch/lsearch.c')
-rw-r--r-- | libc/misc/lsearch/lsearch.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/libc/misc/lsearch/lsearch.c b/libc/misc/lsearch/lsearch.c deleted file mode 100644 index 8b10fd874..000000000 --- a/libc/misc/lsearch/lsearch.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file lifted in toto from 'Dlibs' on the atari ST (RdeBath) - * - * - * Dale Schumacher 399 Beacon Ave. - * (alias: Dalnefre') St. Paul, MN 55104 - * dal@syntel.UUCP United States of America - * "It's not reality that's important, but how you perceive things." - */ - -#include <string.h> -#include <stdio.h> -#include <search.h> - -void *lfind(const void *key, const void *base, size_t *nmemb, - size_t size, int (*compar)(const void *, const void *)) -{ - register int n = *nmemb; - - while (n--) { - if ((*compar) (base, key) == 0) - return ((void*)base); - base += size; - } - return (NULL); -} - -void *lsearch(const void *key, void *base, size_t *nmemb, - size_t size, int (*compar)(const void *, const void *)) -{ - register char *p; - - if ((p = lfind(key, base, nmemb, size, compar)) == NULL) { - p = memcpy((base + (size * (*nmemb))), key, size); - ++(*nmemb); - } - return (p); -} |