~ubuntu-branches/ubuntu/natty/ibm-3270/natty

« back to all changes in this revision

Viewing changes to c3270/toggles.c

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2009-12-14 11:48:53 UTC
  • mfrom: (1.1.4 upstream) (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091214114853-mywixml32hct9jr1
Tags: 3.3.10ga4-2
* Fix section to match override.
* Use debhelper compat level 7.
* Use 3.0 (quilt) source format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Modifications Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2004, 2005
3
 
 *   by Paul Mattes.
4
 
 * Original X11 Port Copyright 1990 by Jeff Sparkes.
5
 
 *  Permission to use, copy, modify, and distribute this software and its
6
 
 *  documentation for any purpose and without fee is hereby granted,
7
 
 *  provided that the above copyright notice appear in all copies and that
8
 
 *  both that copyright notice and this permission notice appear in
9
 
 *  supporting documentation.
10
 
 *
11
 
 * Copyright 1989 by Georgia Tech Research Corporation, Atlanta, GA 30332.
12
 
 *  All Rights Reserved.  GTRC hereby grants public use of this software.
13
 
 *  Derivative works based on this software must incorporate this copyright
14
 
 *  notice.
15
 
 *
16
 
 * x3270, c3270, s3270 and tcl3270 are distributed in the hope that they will
17
 
 * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the file LICENSE
19
 
 * for more details.
 
2
 * Copyright (c) 1993-2009, Paul Mattes.
 
3
 * Copyright (c) 1990, Jeff Sparkes.
 
4
 * Copyright (c) 1989, Georgia Tech Research Corporation (GTRC), Atlanta, GA
 
5
 *  30332.
 
6
 * All rights reserved.
 
7
 *
 
8
 * Redistribution and use in source and binary forms, with or without
 
9
 * modification, are permitted provided that the following conditions are met:
 
10
 *     * Redistributions of source code must retain the above copyright
 
11
 *       notice, this list of conditions and the following disclaimer.
 
12
 *     * Redistributions in binary form must reproduce the above copyright
 
13
 *       notice, this list of conditions and the following disclaimer in the
 
14
 *       documentation and/or other materials provided with the distribution.
 
15
 *     * Neither the names of Paul Mattes, Jeff Sparkes, GTRC nor the names of
 
16
 *       their contributors may be used to endorse or promote products derived
 
17
 *       from this software without specific prior written permission.
 
18
 *
 
19
 * THIS SOFTWARE IS PROVIDED BY PAUL MATTES, JEFF SPARKES AND GTRC "AS IS" AND
 
20
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
21
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
22
 * ARE DISCLAIMED. IN NO EVENT SHALL PAUL MATTES, JEFF SPARKES OR GTRC BE
 
23
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 
24
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
25
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
26
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 
27
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
28
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
29
 * POSSIBILITY OF SUCH DAMAGE.
20
30
 */
21
31
 
22
32
/*
50
60
         * menu label(s).
51
61
         */
52
62
        toggle_toggle(t);
53
 
        t->upcall(t, reason);
 
63
        if (t->upcall != NULL)
 
64
                t->upcall(t, reason);
54
65
#if defined(X3270_MENUS) /*[*/
55
66
        menubar_retoggle(t);
56
67
#endif /*]*/
94
105
#if defined(X3270_SCRIPT) || defined(TCL3270) /*[*/
95
106
        appres.toggle[AID_WAIT].upcall =         toggle_nop;
96
107
#endif /*]*/
 
108
#if defined(C3270) /*[*/
 
109
        appres.toggle[UNDERSCORE].upcall =       toggle_underscore;
 
110
#endif /*]*/
97
111
 
98
112
#if defined(X3270_TRACE) /*[*/
99
113
        if (toggled(DS_TRACE))
134
148
}
135
149
 
136
150
void
137
 
Toggle_action(Widget w unused, XEvent *event, String *params,
 
151
Toggle_action(Widget w _is_unused, XEvent *event, String *params,
138
152
    Cardinal *num_params)
139
153
{
140
154
        int j;
 
155
        int ix;
141
156
 
142
157
        action_debug(Toggle_action, event, params, num_params);
143
158
        if (check_usage(Toggle_action, *num_params, 1, 2) < 0)
144
159
                return;
145
 
        for (j = 0; j < N_TOGGLES; j++)
146
 
                if (toggle_names[j].index >= 0 &&
147
 
                    !strcasecmp(params[0], toggle_names[j].name)) {
 
160
        for (j = 0; toggle_names[j].name != NULL; j++) {
 
161
                if (!strcasecmp(params[0], toggle_names[j].name)) {
 
162
                        ix = toggle_names[j].index;
148
163
                        break;
149
164
                }
150
 
        if (j >= N_TOGGLES) {
 
165
        }
 
166
        if (toggle_names[j].name == NULL) {
151
167
                popup_an_error("%s: Unknown toggle name '%s'",
152
168
                    action_name(Toggle_action), params[0]);
153
169
                return;
154
170
        }
155
171
 
156
172
        if (*num_params == 1) {
157
 
                do_toggle_reason(j, TT_ACTION);
 
173
                do_toggle_reason(ix, TT_ACTION);
158
174
        } else if (!strcasecmp(params[1], "set")) {
159
 
                if (!toggled(j)) {
160
 
                        do_toggle_reason(j, TT_ACTION);
 
175
                if (!toggled(ix)) {
 
176
                        do_toggle_reason(ix, TT_ACTION);
161
177
                }
162
178
        } else if (!strcasecmp(params[1], "clear")) {
163
 
                if (toggled(j)) {
164
 
                        do_toggle_reason(j, TT_ACTION);
 
179
                if (toggled(ix)) {
 
180
                        do_toggle_reason(ix, TT_ACTION);
165
181
                }
166
182
        } else {
167
183
                popup_an_error("%s: Unknown keyword '%s' (must be 'set' or "