[comp.unix] hsearch

wacohen@phoenix.princeton.edu (William Alan Cohen) (10/08/89)

Hello... I'm not a regular reader of this group but I've got
this problem, see, and I thought maybe someone would like to help.

It's about the hsearch command I found in some documentation.
It's a built-in hash table manager, and I can't figure out how
it handles storage keys... sometimes there are finds where there
shouldn't be, other times it seems to fail to find matches.  Does
anyone have any experience with the command and/or know if it
may be buggy on my machine?

   Thanks for your time (you read this, no?)

     Bill

pag@tcsc3b2.tcsc.com (Philip A. Gross) (10/15/89)

wacohen@phoenix.princeton.edu (William Alan Cohen) writes:

>Hello... I'm not a regular reader of this group but I've got
>this problem, see, and I thought maybe someone would like to help.

>It's about the hsearch command I found in some documentation.
>It's a built-in hash table manager, and I can't figure out how
>it handles storage keys... sometimes there are finds where there
>shouldn't be, other times it seems to fail to find matches.  Does
>anyone have any experience with the command and/or know if it
>may be buggy on my machine?

>   Thanks for your time (you read this, no?)

>     Bill

I am not as familiar with the hsearch(3C) functions as well as I am with
the tsearch(3C) (binary tree) functions.  However, with the use of
tsearch, the functions store a pointer to the pointer you give it.  So
in your comparison/search functions, you should make sure that your are
properly dereferencing the pointers.


Philip A. Gross       The Computer Solution Co., Inc.       Voice: 804-794-3491
INTERNET:	pag@tcsc3b2.tcsc.com
UUCP:		tcsc3b2!pag	(804)794-1514
        The opinions expressed here are strictly mine and nobody elses.