diff options
author | 2003-05-08 23:21:36 +0000 | |
---|---|---|
committer | 2003-05-08 23:21:36 +0000 | |
commit | 964aabfc36ece633eae4fbbc2aac174c971e2416 (patch) | |
tree | 0e9019472752f2ed20f2abcdae0bb700fda5431d | |
parent | {e,f,g}cvt() are no longer missing. (diff) | |
download | wireguard-openbsd-964aabfc36ece633eae4fbbc2aac174c971e2416.tar.xz wireguard-openbsd-964aabfc36ece633eae4fbbc2aac174c971e2416.zip |
move lsearch(3) and insque(3) from libcompat -> libc; they are now POSIX
-rw-r--r-- | lib/libc/stdlib/Makefile.inc | 15 | ||||
-rw-r--r-- | lib/libc/stdlib/lsearch.3 (renamed from lib/libcompat/4.3/lsearch.3) | 15 | ||||
-rw-r--r-- | lib/libc/stdlib/lsearch.c (renamed from lib/libcompat/4.3/lsearch.c) | 21 | ||||
-rw-r--r-- | lib/libcompat/Makefile | 7 |
4 files changed, 28 insertions, 30 deletions
diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index 98c13c8c8e6..d2034982fe2 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -5,10 +5,10 @@ SRCS+= a64l.c abort.c atexit.c atoi.c atof.c atol.c atoll.c bsearch.c \ calloc.c cfree.c exit.c ecvt.c gcvt.c getenv.c getopt.c getopt_long.c \ - getsubopt.c heapsort.c l64a.c malloc.c merge.c multibyte.c putenv.c \ - qsort.c radixsort.c rand.c random.c realpath.c setenv.c strtod.c \ - strtol.c strtoll.c strtoul.c strtoull.c system.c tfind.c tsearch.c \ - _rand48.c drand48.c erand48.c jrand48.c lcong48.c lrand48.c \ + getsubopt.c heapsort.c l64a.c lsearch.c malloc.c merge.c multibyte.c \ + putenv.c qsort.c radixsort.c rand.c random.c realpath.c setenv.c \ + strtod.c strtol.c strtoll.c strtoul.c strtoull.c system.c tfind.c \ + tsearch.c _rand48.c drand48.c erand48.c jrand48.c lcong48.c lrand48.c \ mrand48.c nrand48.c seed48.c srand48.c qabs.c qdiv.c .if (${MACHINE_ARCH} == "m68k") @@ -34,13 +34,14 @@ SRCS+= abs.c div.c labs.c ldiv.c MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 atoll.3 \ bsearch.3 div.3 ecvt.3 exit.3 getenv.3 getopt.3 getopt_long.3 \ - getsubopt.3 labs.3 ldiv.3 malloc.3 memory.3 qabs.3 qdiv.3 qsort.3 \ - radixsort.3 rand48.3 rand.3 random.3 realpath.3 strtod.3 strtol.3 \ - strtoul.3 system.3 tsearch.3 + getsubopt.3 labs.3 ldiv.3 lsearch.3 malloc.3 memory.3 qabs.3 qdiv.3 \ + qsort.3 radixsort.3 rand48.3 rand.3 random.3 realpath.3 strtod.3 \ + strtol.3 strtoul.3 system.3 tsearch.3 MLINKS+=ecvt.3 fcvt.3 ecvt.3 gcvt.3 MLINKS+=getenv.3 setenv.3 getenv.3 unsetenv.3 getenv.3 putenv.3 MLINKS+=getopt_long.3 getopt_long_only.3 +MLINKS+=lsearch.3 lfind.3 MLINKS+=malloc.3 free.3 malloc.3 realloc.3 malloc.3 calloc.3 MLINKS+=malloc.3 cfree.3 malloc.3 malloc.conf.5 MLINKS+=qsort.3 heapsort.3 qsort.3 mergesort.3 diff --git a/lib/libcompat/4.3/lsearch.3 b/lib/libc/stdlib/lsearch.3 index 2b57f51bb55..3e17d131e45 100644 --- a/lib/libcompat/4.3/lsearch.3 +++ b/lib/libc/stdlib/lsearch.3 @@ -44,11 +44,6 @@ .Ft char * .Fn lfind "const void *key" "const void *base" "size_t *nelp" "size_t width" "int (*compar)(void *, void *)" .Sh DESCRIPTION -.Bf -symbolic -These interfaces were obsolete before they were written. -They are available from the compatibility library, libcompat. -.Ef -.Pp The functions .Fn lsearch , and @@ -100,3 +95,13 @@ is incremented by one. .Sh SEE ALSO .Xr bsearch 3 , .Xr db 3 +.Sh STANDARDS +The +.Fn lsearch +and +.Fn lfind +functions conform to the +.St -p1003.1-01 +and +.St -xpg4.3 . +specifications. diff --git a/lib/libcompat/4.3/lsearch.c b/lib/libc/stdlib/lsearch.c index 23ad2c40ca6..ba0aad3cfcb 100644 --- a/lib/libcompat/4.3/lsearch.c +++ b/lib/libc/stdlib/lsearch.c @@ -47,32 +47,25 @@ static void *linear_base(const void *, const void *, size_t *, size_t, cmp_fn_t, int); void * -lsearch(key, base, nelp, width, compar) - const void *key, *base; - size_t *nelp, width; - cmp_fn_t compar; +lsearch(const void *key, const void *base, size_t *nelp, size_t width, + cmp_fn_t compar) { return(linear_base(key, base, nelp, width, compar, 1)); } void * -lfind(key, base, nelp, width, compar) - const void *key, *base; - size_t *nelp, width; - cmp_fn_t compar; +lfind(const void *key, const void *base, size_t *nelp, size_t width, + cmp_fn_t compar) { return(linear_base(key, base, nelp, width, compar, 0)); } static void * -linear_base(key, base, nelp, width, compar, add_flag) - const void *key, *base; - size_t *nelp, width; - cmp_fn_t compar; - int add_flag; +linear_base(const void *key, const void *base, size_t *nelp, size_t width, + cmp_fn_t compar, int add_flag) { - register const char *element, *end; + const char *element, *end; end = (const char *)base + *nelp * width; for (element = base; element < end; element += width) diff --git a/lib/libcompat/Makefile b/lib/libcompat/Makefile index bef260b2780..477732655ef 100644 --- a/lib/libcompat/Makefile +++ b/lib/libcompat/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.8 2003/05/08 23:15:02 millert Exp $ +# $OpenBSD: Makefile,v 1.9 2003/05/08 23:21:36 millert Exp $ # $NetBSD: Makefile,v 1.15 1995/09/07 07:17:53 jtc Exp $ LIB= compat @@ -27,13 +27,12 @@ MLINKS+=stty.3 gtty.3 # compat 4.3 sources # missing: sibuf.c sobuf.c strout.c -SRCS+= lsearch.c regex.c rexec.c +SRCS+= regex.c rexec.c SRCS+= insque.c remque.c -MAN+= insque.3 lsearch.3 re_comp.3 rexec.3 +MAN+= insque.3 re_comp.3 rexec.3 MLINKS+=insque.3 remque.3 -MLINKS+=lsearch.3 lfind.3 MLINKS+=re_comp.3 re_exec.3 # compat 4.4 sources |