Mercurial > emacs
annotate oldXMenu/FindSel.c @ 68212:0c77c0b9a620
* mh-comp.el (mh-show-buffer-message-number): Replace (car
(read-from-string string) with (string-to-number string).
* mh-e.el (mh-parse-flist-output-line, mh-folder-size-folder): Ditto.
* mh-mime.el (mh-mml-forward-message): Ditto.
* mh-search.el (mh-swish-next-result, mh-mairix-next-result)
(mh-namazu-next-result, mh-grep-next-result, mh-md5sum-parser)
(mh-openssl-parser, mh-index-update-maps): Ditto.
* mh-seq.el (mh-translate-range, mh-narrow-to-header-field)
(mh-thread-generate): Ditto.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Mon, 16 Jan 2006 20:05:14 +0000 |
parents | 3861ff8f4bf1 |
children | e8a3fb527b77 532e0a9335a9 2d92f5c9d6ae |
rev | line source |
---|---|
25858 | 1 #include "copyright.h" |
2 | |
3 /* Copyright Massachusetts Institute of Technology 1985 */ | |
65000
3861ff8f4bf1
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54770
diff
changeset
|
4 /* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. */ |
25858 | 5 |
6 /* | |
7 * XMenu: MIT Project Athena, X Window system menu package | |
8 * | |
9 * XMenuFindSelection - Find the first selection in a pane who's | |
10 * label matches a particular string. | |
11 * | |
12 * Author: Tony Della Fera, DEC | |
13 * January 22, 1986 | |
14 * | |
15 */ | |
16 | |
17 #include "XMenuInt.h" | |
18 | |
19 int | |
20 XMenuFindSelection(menu, p_num, label) | |
21 register XMenu *menu; | |
22 int p_num; | |
23 register char *label; | |
24 { | |
25 register XMPane *p_ptr; | |
26 register XMSelect *s_ptr; | |
27 register int i = 0; | |
28 | |
29 /* | |
30 * Check for NULL pointers! | |
31 */ | |
32 if (label == NULL) { | |
33 _XMErrorCode = XME_ARG_BOUNDS; | |
34 return(XM_FAILURE); | |
35 } | |
36 | |
37 /* | |
38 * Find the right pane. | |
39 */ | |
40 p_ptr = _XMGetPanePtr(menu, p_num); | |
41 if (p_ptr == NULL) return(XM_FAILURE); | |
42 | |
43 /* | |
44 * Find the right selection. | |
45 */ | |
46 for ( | |
47 s_ptr = p_ptr->s_list->next; | |
48 s_ptr != p_ptr->s_list; | |
49 s_ptr = s_ptr->next | |
50 ){ | |
51 if (s_ptr->label_length == 0) { | |
52 if (*label == '\0') { | |
53 _XMErrorCode = XME_NO_ERROR; | |
54 return (i); | |
55 } | |
56 } | |
57 else { | |
58 if (strncmp (label, s_ptr->label, s_ptr->label_length) == 0) { | |
59 _XMErrorCode = XME_NO_ERROR; | |
60 return (i); | |
61 } | |
62 } | |
63 i++; | |
64 } | |
65 | |
66 /* | |
67 * If we get here then we have not found | |
68 * a match. | |
69 */ | |
70 _XMErrorCode = XME_S_NOT_FOUND; | |
71 return (XM_FAILURE); | |
72 } | |
52401 | 73 |
74 /* arch-tag: 564a4a95-9ab0-4580-b05f-6970c4b25dd4 | |
75 (do not change this comment) */ |