annotate oldXMenu/FindSel.c @ 111389:2135a94a0773

ChangeLog fix.
author Glenn Morris <rgm@gnu.org>
date Mon, 08 Nov 2010 20:39:11 -0800
parents 1d1d5d9bd884
children 5cc91198ffb2 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
100952
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
1 /* Copyright Massachusetts Institute of Technology 1985 */
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
2
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
3 #include "copyright.h"
Dave Love <fx@gnu.org>
parents:
diff changeset
4
100952
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
5 /*
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
6 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100952
diff changeset
7 2009, 2010 Free Software Foundation, Inc.
100952
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
8
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
9 This program is free software: you can redistribute it and/or modify
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
10 it under the terms of the GNU General Public License as published by
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
11 the Free Software Foundation, either version 3 of the License, or
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
12 (at your option) any later version.
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
13
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
14 This program is distributed in the hope that it will be useful,
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
17 GNU General Public License for more details.
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
18
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
19 You should have received a copy of the GNU General Public License
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
21 */
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
22
Dave Love <fx@gnu.org>
parents:
diff changeset
23 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
24 * XMenu: MIT Project Athena, X Window system menu package
Dave Love <fx@gnu.org>
parents:
diff changeset
25 *
Dave Love <fx@gnu.org>
parents:
diff changeset
26 * XMenuFindSelection - Find the first selection in a pane who's
Dave Love <fx@gnu.org>
parents:
diff changeset
27 * label matches a particular string.
Dave Love <fx@gnu.org>
parents:
diff changeset
28 *
Dave Love <fx@gnu.org>
parents:
diff changeset
29 * Author: Tony Della Fera, DEC
Dave Love <fx@gnu.org>
parents:
diff changeset
30 * January 22, 1986
Dave Love <fx@gnu.org>
parents:
diff changeset
31 *
Dave Love <fx@gnu.org>
parents:
diff changeset
32 */
Dave Love <fx@gnu.org>
parents:
diff changeset
33
Dave Love <fx@gnu.org>
parents:
diff changeset
34 #include "XMenuInt.h"
Dave Love <fx@gnu.org>
parents:
diff changeset
35
Dave Love <fx@gnu.org>
parents:
diff changeset
36 int
Dave Love <fx@gnu.org>
parents:
diff changeset
37 XMenuFindSelection(menu, p_num, label)
Dave Love <fx@gnu.org>
parents:
diff changeset
38 register XMenu *menu;
Dave Love <fx@gnu.org>
parents:
diff changeset
39 int p_num;
Dave Love <fx@gnu.org>
parents:
diff changeset
40 register char *label;
Dave Love <fx@gnu.org>
parents:
diff changeset
41 {
Dave Love <fx@gnu.org>
parents:
diff changeset
42 register XMPane *p_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
43 register XMSelect *s_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
44 register int i = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
45
Dave Love <fx@gnu.org>
parents:
diff changeset
46 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
47 * Check for NULL pointers!
Dave Love <fx@gnu.org>
parents:
diff changeset
48 */
Dave Love <fx@gnu.org>
parents:
diff changeset
49 if (label == NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
50 _XMErrorCode = XME_ARG_BOUNDS;
Dave Love <fx@gnu.org>
parents:
diff changeset
51 return(XM_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
52 }
Dave Love <fx@gnu.org>
parents:
diff changeset
53
Dave Love <fx@gnu.org>
parents:
diff changeset
54 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
55 * Find the right pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
56 */
Dave Love <fx@gnu.org>
parents:
diff changeset
57 p_ptr = _XMGetPanePtr(menu, p_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
58 if (p_ptr == NULL) return(XM_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
59
Dave Love <fx@gnu.org>
parents:
diff changeset
60 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
61 * Find the right selection.
Dave Love <fx@gnu.org>
parents:
diff changeset
62 */
Dave Love <fx@gnu.org>
parents:
diff changeset
63 for (
Dave Love <fx@gnu.org>
parents:
diff changeset
64 s_ptr = p_ptr->s_list->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
65 s_ptr != p_ptr->s_list;
Dave Love <fx@gnu.org>
parents:
diff changeset
66 s_ptr = s_ptr->next
Dave Love <fx@gnu.org>
parents:
diff changeset
67 ){
Dave Love <fx@gnu.org>
parents:
diff changeset
68 if (s_ptr->label_length == 0) {
Dave Love <fx@gnu.org>
parents:
diff changeset
69 if (*label == '\0') {
Dave Love <fx@gnu.org>
parents:
diff changeset
70 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
71 return (i);
Dave Love <fx@gnu.org>
parents:
diff changeset
72 }
Dave Love <fx@gnu.org>
parents:
diff changeset
73 }
Dave Love <fx@gnu.org>
parents:
diff changeset
74 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
75 if (strncmp (label, s_ptr->label, s_ptr->label_length) == 0) {
Dave Love <fx@gnu.org>
parents:
diff changeset
76 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
77 return (i);
Dave Love <fx@gnu.org>
parents:
diff changeset
78 }
Dave Love <fx@gnu.org>
parents:
diff changeset
79 }
Dave Love <fx@gnu.org>
parents:
diff changeset
80 i++;
Dave Love <fx@gnu.org>
parents:
diff changeset
81 }
Dave Love <fx@gnu.org>
parents:
diff changeset
82
Dave Love <fx@gnu.org>
parents:
diff changeset
83 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
84 * If we get here then we have not found
Dave Love <fx@gnu.org>
parents:
diff changeset
85 * a match.
Dave Love <fx@gnu.org>
parents:
diff changeset
86 */
Dave Love <fx@gnu.org>
parents:
diff changeset
87 _XMErrorCode = XME_S_NOT_FOUND;
Dave Love <fx@gnu.org>
parents:
diff changeset
88 return (XM_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
89 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 25858
diff changeset
90
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 25858
diff changeset
91 /* arch-tag: 564a4a95-9ab0-4580-b05f-6970c4b25dd4
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 25858
diff changeset
92 (do not change this comment) */