(Key Lookup): Clarify wrt commands vs other functions.
[emacs.git] / oldXMenu / FindPane.c
blob6c0be73f0fbdc58633f22dcafdee34d39b85b076
1 #include "copyright.h"
3 /* Copyright Massachusetts Institute of Technology 1985 */
4 /* Copyright (C) 2002, 2003, 2004, 2005,
5 2006 Free Software Foundation, Inc. */
7 /*
8 * XMenu: MIT Project Athena, X Window system menu package
10 * XMenuFindPane - Find the first menu pane who's label matches a
11 * particular string.
13 * Author: Tony Della Fera, DEC
14 * January 22, 1986
18 #include "XMenuInt.h"
20 int
21 XMenuFindPane(menu, label)
22 register XMenu *menu;
23 register char *label;
25 register XMPane *p_ptr;
26 register int i = 0;
29 * Check for NULL pointers!
31 if (label == NULL) {
32 _XMErrorCode = XME_ARG_BOUNDS;
33 return(XM_FAILURE);
37 * Find the pane who's label matches the given label.
39 for (
40 p_ptr = menu->p_list->next;
41 p_ptr != menu->p_list;
42 p_ptr = p_ptr->next
44 if (p_ptr->label_length == 0) {
45 if (*label == '\0') {
46 _XMErrorCode = XME_NO_ERROR;
47 return (i);
50 else {
51 if (strncmp (label, p_ptr->label, p_ptr->label_length) == 0) {
52 _XMErrorCode = XME_NO_ERROR;
53 return (i);
56 i++;
60 * If we get here then we have not found
61 * a match.
63 _XMErrorCode = XME_P_NOT_FOUND;
64 return (XM_FAILURE);
67 /* arch-tag: b6c94285-0d1d-4569-a071-b34b63c67a54
68 (do not change this comment) */