grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / icon / findtooltype.c
blobea9a50263b9c82ece7706a90c5a08fb01dbe67b3
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Find a tooltype entry from an array of tool types.
6 */
7 #include "icon_intern.h"
9 /*****************************************************************************
11 NAME */
12 #include <proto/icon.h>
14 AROS_LH2(UBYTE *, FindToolType,
16 /* SYNOPSIS */
17 AROS_LHA(CONST STRPTR *, toolTypeArray, A0),
18 AROS_LHA(CONST STRPTR, typeName, A1),
20 /* LOCATION */
21 struct IconBase *, IconBase, 16, Icon)
23 /* FUNCTION
24 Finds the supplied typeName inside the given toolTypeArray.
25 Search is case-insensitive.
27 INPUTS
28 toolTypeArray - pointer to an array of tooltype strings.
29 typeName - name of a specific tool-type.
31 RESULT
32 NULL if the tooltype wasn't found and a pointer to the value
33 of the tooltype otherwise.
35 NOTES
37 EXAMPLE
39 BUGS
41 SEE ALSO
42 MatchToolValue()
44 INTERNALS
46 HISTORY
48 *****************************************************************************/
50 AROS_LIBFUNC_INIT
52 ULONG typenamelen = 0;
54 /* Make sure we have sane input parameters */
55 if (toolTypeArray == NULL || typeName == NULL) return NULL;
57 typenamelen = strlen(typeName);
59 while (*toolTypeArray)
61 /* case insensitive compare */
62 if (!Strnicmp (*toolTypeArray, typeName, typenamelen) )
64 if ( (*toolTypeArray)[typenamelen] == '=') typenamelen++;
65 return (*toolTypeArray + typenamelen);
68 toolTypeArray ++;
71 return NULL;
73 AROS_LIBFUNC_EXIT
74 } /* FindToolType */