Include <X11/Xlib.h> even if USE_VIDMODE is
[tangerine.git] / rom / exec / findname.c
blob0cdb07887c000321815e140c79b9f5c72e2bf82e
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Search for a node by name.
6 Lang: english
7 */
8 #include <string.h>
9 #include <aros/debug.h>
11 /*****************************************************************************
13 NAME */
14 #include <exec/lists.h>
15 #include <proto/exec.h>
17 AROS_LH2I(struct Node *, FindName,
19 /* SYNOPSIS */
20 AROS_LHA(struct List *, list, A0),
21 AROS_LHA(const UBYTE *, name, A1),
23 /* LOCATION */
24 struct ExecBase *, SysBase, 46, Exec)
26 /* FUNCTION
27 Look for a node with a certain name in a list.
29 INPUTS
30 list - Search this list.
31 name - This is the name to look for.
33 RESULT
35 NOTES
36 The search is case-sensitive, so "Hello" will not find a node
37 named "hello".
39 The list must contain complete Nodes and no MinNodes.
41 EXAMPLE
42 struct List * list;
43 struct Node * node;
45 // Look for a node with the name "Hello"
46 node = FindName (list, "Hello");
48 BUGS
50 SEE ALSO
52 INTERNALS
54 ******************************************************************************/
56 AROS_LIBFUNC_INIT
57 struct Node * node;
59 ASSERT(list != NULL);
60 ASSERT(list != NULL);
62 /* Look through the list */
63 for (node=GetHead(list); node; node=GetSucc(node))
65 /* Only compare the names if this node has one. */
66 if(node->ln_Name)
68 /* Check the node. If we found it, stop. */
69 if (!strcmp (node->ln_Name, name))
70 break;
75 If we found a node, this will contain the pointer to it. If we
76 didn't, this will be NULL (either because the list was
77 empty or because we tried all nodes in the list)
79 return node;
80 AROS_LIBFUNC_EXIT
81 } /* FindName */