]> code.delx.au - gnu-emacs/blob - oldXMenu/FindPane.c
(Program Modes): Replace inforef to emacs-xtra by conditional xref's, depending
[gnu-emacs] / oldXMenu / FindPane.c
1 #include "copyright.h"
2
3 /* Copyright Massachusetts Institute of Technology 1985 */
4 /* Copyright (C) 2002, 2003, 2004, 2005,
5 2006 Free Software Foundation, Inc. */
6
7 /*
8 * XMenu: MIT Project Athena, X Window system menu package
9 *
10 * XMenuFindPane - Find the first menu pane who's label matches a
11 * particular string.
12 *
13 * Author: Tony Della Fera, DEC
14 * January 22, 1986
15 *
16 */
17
18 #include "XMenuInt.h"
19
20 int
21 XMenuFindPane(menu, label)
22 register XMenu *menu;
23 register char *label;
24 {
25 register XMPane *p_ptr;
26 register int i = 0;
27
28 /*
29 * Check for NULL pointers!
30 */
31 if (label == NULL) {
32 _XMErrorCode = XME_ARG_BOUNDS;
33 return(XM_FAILURE);
34 }
35
36 /*
37 * Find the pane who's label matches the given label.
38 */
39 for (
40 p_ptr = menu->p_list->next;
41 p_ptr != menu->p_list;
42 p_ptr = p_ptr->next
43 ){
44 if (p_ptr->label_length == 0) {
45 if (*label == '\0') {
46 _XMErrorCode = XME_NO_ERROR;
47 return (i);
48 }
49 }
50 else {
51 if (strncmp (label, p_ptr->label, p_ptr->label_length) == 0) {
52 _XMErrorCode = XME_NO_ERROR;
53 return (i);
54 }
55 }
56 i++;
57 }
58
59 /*
60 * If we get here then we have not found
61 * a match.
62 */
63 _XMErrorCode = XME_P_NOT_FOUND;
64 return (XM_FAILURE);
65 }
66
67 /* arch-tag: b6c94285-0d1d-4569-a071-b34b63c67a54
68 (do not change this comment) */