minor manual page corrections; rip out rlsearch() and wlsearch().
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Thu, 22 Feb 1990 04:58:57 +0000 (20:58 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Thu, 22 Feb 1990 04:58:57 +0000 (20:58 -0800)
SCCS-vsn: lib/libcompat/4.3/lsearch.3 5.2
SCCS-vsn: lib/libcompat/4.3/lsearch.c 5.2

usr/src/lib/libcompat/4.3/lsearch.3
usr/src/lib/libcompat/4.3/lsearch.c

index 97de878..a876b1b 100644 (file)
 .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
 .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.\"    @(#)lsearch.3   5.1 (Berkeley) %G%
+.\"    @(#)lsearch.3   5.2 (Berkeley) %G%
 .\"
 .TH LSEARCH 3 ""
 .UC 7
 .SH NAME
 .\"
 .TH LSEARCH 3 ""
 .UC 7
 .SH NAME
-lsearch, lfind, rlsearch, wlsearch \- linear searching routines
+lsearch, lfind, \- linear searching routines
 .SH SYNOPSIS
 .ft B
 .nf
 .SH SYNOPSIS
 .ft B
 .nf
-char *lsearch(key, base, nelp, width, compar)
-char *key, base;
-unsigned int *nelp, width;
-int (*compar)();
+char *
+lsearch(const void *key, const void *base,
+size_t *nelp, size_t width, 
+int (*compar) (void *, void *));
 .sp
 .sp
-char *lfind(key, base, nelp, width, compar)
-char *key, base;
-unsigned int *nelp, width;
-int (*compar)();
-.sp
-char *rlsearch(fd, nelp, width)
-int fd;
-unsigned int *nelp, *width;
-.sp
-wlsearch(fd, base, nelp, width)
-int fd;
-char *base;
-unsigned int nelp, width;
+char *
+lfind(const void *key, const void *base,
+size_t *nelp, size_t width,
+int (*compar) (void *, void *));
 .ft R
 .SH DESCRIPTION
 .ft R
 .SH DESCRIPTION
+.ft B
+This interface was obsolete before it was written.
+It is available from the compatibility library, libcompat.
+.ft R
+.PP
 The functions
 .IR lsearch ,
 The functions
 .IR lsearch ,
-.IR lfind ,
-.IR rlsearch ,
 and
 and
-.I wlsearch
+.IR lfind
 provide basic linear searching functionality.
 .PP
 .I Base
 provide basic linear searching functionality.
 .PP
 .I Base
@@ -59,9 +53,13 @@ is
 bytes long.
 .I Compar
 is a comparison routine which is used to compare two elements.
 bytes long.
 .I Compar
 is a comparison routine which is used to compare two elements.
-It is called with two arguments that are pointers to the two elements
-to be compared and must return 0 if the elements are equal and non-zero
-otherwise.
+It is called with two arguments that point to the 
+.I key
+object and to an array member, in that order, and must return an integer
+less than, equal to, or greater than zero if the 
+.I key
+object is considered, respectively, to be less than, equal to, or greater
+than the array member.
 .PP
 .I Lsearch
 and
 .PP
 .I Lsearch
 and
@@ -83,29 +81,5 @@ When an element is added to the array by
 the location referenced by the argument
 .I nelp
 is incremented by one.
 the location referenced by the argument
 .I nelp
 is incremented by one.
-.PP
-.I Wlsearch
-writes the array pointed to by
-.I base
-to the file descriptor
-.IR fd ,
-preceded by a machine independent representation of the number
-of elements and the element width as
-.IR longs .
-A value of 0 is returned on success and -1 if an error occurs.
-.PP
-.I Rlsearch
-returns a pointer to a
-.IR malloc 'd
-array read from the file descriptor
-.IR fd ,
-as written by
-.IR wlsearch .
-The number of elements in the array and the width of each element is
-stored in the locations referenced by
-.I nelp
-and
-.IR width .
-NULL is returned if an error occurs.
 .SH "SEE ALSO"
 bsearch(3), hsearch(3), tsearch(3)
 .SH "SEE ALSO"
 bsearch(3), hsearch(3), tsearch(3)
index 22bc172..e0ea0e8 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)lsearch.c  5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)lsearch.c  5.2 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -74,43 +74,3 @@ linear_base(key, base, nelp, width, compar, add_flag)
        bcopy(key, end, (int)width);
        return(end);
 }
        bcopy(key, end, (int)width);
        return(end);
 }
-
-char *
-rlsearch(fd, nelp, width)
-       int fd;
-       u_int *nelp, *width;
-{
-       register u_int len;
-       long val;
-       char *base, *malloc();
-
-       if (read(fd, (char *)&val, sizeof(long)) != sizeof(long))
-               return(NULL);
-       *nelp = (u_int)ntohl(val);
-       if (read(fd, (char *)&val, sizeof(long)) != sizeof(long))
-               return(NULL);
-       *width = (u_int)ntohl(val);
-
-       len = *nelp * *width;
-       if (!(base = malloc(len)))
-               return(NULL);
-       return(read(fd, base, len) == len ? base : NULL);
-}
-
-wlsearch(fd, base, nelp, width)
-       int fd;
-       char *base;
-       u_int nelp, width;
-{
-       long val;
-
-       val = htonl((long)nelp);
-       if (write(fd, (char *)&val, sizeof(long)) != sizeof(long))
-               return(-1);
-       val = htonl((long)width);
-       if (write(fd, (char *)&val, sizeof(long)) != sizeof(long))
-               return(-1);
-       if (write(fd, base, nelp * width) != nelp * width)
-               return(-1);
-       return(0);
-}