1namefind(3)                  MBK UTILITY FUNCTIONS                 namefind(3)
2
3
4

NAME

6       namefind - hash table for strings
7

SYNOPSIS

9       #include "mut.h"
10       char ∗namefind(inputname)
11       char ∗inputname;
12

PARAMETER

14       inputname           Pointer to a string of characters
15

DESCRIPTION

17       The  namefind  function  search  the  mbk  dictionary of names.  If the
18       string has already been inserted in the dictionary, then a  pointer  to
19       this string is return, else namefind returns NULL.
20       The  case  of the letters do not matter. All names are changed to lower
21       case before being searched in the symbol table. This is needed  because
22       most of the file format do not check case.
23       namefind  is  used  by all mbk utility function using names, so its use
24       should be needed only when directly filling or modifying the structure,
25       or when having to compare an external string to mbk internal ones. This
26       should speed up string comparisons.
27       One shall never modify the contains of a string pointed to by a  result
28       of  namefind,  since  all the field that points to this name would have
29       there values modified, and that there is no chance that  the  new  hash
30       code  will  be  the same as the old one, so pointer comparison would be
31       meaningless. All string used by  namefind  are  constants  string,  and
32       therefore must be left alone.
33

RETURN VALUE

35       namefind  returns  a  string pointer if the inputname is already in the
36       hash table, else NULL.
37

EXAMPLE

39       #include "mut.h"
40       #include "mlo.h"
41       lofig_list ∗find_fig(name)
42       char ∗name;
43       {
44       lofig_list ∗p;
45          name = namefind(name);
46          if (name == NULL)
47              return NULL;
48          for (p = HEAD_LOFIG; p; p = p->NEXT)
49             if (p->NAME == name) /∗ pointer equality ∗/
50                return p;
51          return NULL;
52       }
53

DIAGNOSTICS

55       namefind can be used only after a call to mbkenv(3).
56

SEE ALSO

58       mbk(1) namealloc(3).
59
60
61
62
63
64
65ASIM/LIP6                       October 1, 1997                    namefind(3)
Impressum