3 /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/FindSel.c,v 1.1 1992/04/11 22:10:19 jimb Exp $ */
4 /* Copyright Massachusetts Institute of Technology 1985 */
7 * XMenu: MIT Project Athena, X Window system menu package
9 * XMenuFindSelection - Find the first selection in a pane who's
10 * label matches a particular string.
12 * Author: Tony Della Fera, DEC
20 XMenuFindSelection(menu
, p_num
, label
)
25 register XMPane
*p_ptr
;
26 register XMSelect
*s_ptr
;
30 * Check for NULL pointers!
33 _XMErrorCode
= XME_ARG_BOUNDS
;
38 * Find the right pane.
40 p_ptr
= _XMGetPanePtr(menu
, p_num
);
41 if (p_ptr
== NULL
) return(XM_FAILURE
);
44 * Find the right selection.
47 s_ptr
= p_ptr
->s_list
->next
;
48 s_ptr
!= p_ptr
->s_list
;
51 if (s_ptr
->label_length
== 0) {
53 _XMErrorCode
= XME_NO_ERROR
;
58 if (strncmp (label
, s_ptr
->label
, s_ptr
->label_length
) == 0) {
59 _XMErrorCode
= XME_NO_ERROR
;
67 * If we get here then we have not found
70 _XMErrorCode
= XME_S_NOT_FOUND
;