comparison usr/src/cmd/fmli/menu/mcustom.c @ 0:c9caec207d52 b86

Initial porting based on b86
author Koji Uno <koji.uno@sun.com>
date Tue, 02 Jun 2009 18:56:50 +0900
parents
children 1a15d5aaf794
comparison
equal deleted inserted replaced
-1:000000000000 0:c9caec207d52
1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
24
25
26 /*
27 * Copyright (c) 1986 AT&T
28 * All Rights Reserved
29 */
30
31 #ident "@(#)mcustom.c 1.7 05/06/08 SMI" /* SVr4.0 1.1 */
32
33 #include <stdio.h>
34 #include "wish.h"
35 #include "menu.h"
36 #include "menudefs.h"
37 #include "vtdefs.h"
38 #include "var_arrays.h"
39 #include "ctl.h"
40
41 struct menu *MNU_array;
42
43 menu_id
44 menu_custom(vid, flags, mcols, hcols, dcols, total, disp, arg)
45 vt_id vid;
46 unsigned flags;
47 unsigned mcols;
48 unsigned hcols;
49 unsigned dcols;
50 unsigned total;
51 struct menu_line (*disp)();
52 char *arg;
53 {
54 register int i;
55 int cols;
56 int dummy;
57 register struct menu *m;
58
59 vt_ctl(vid, CTGETSIZ, &dummy, &cols);
60 /* find a free menu structure */
61 for (m = MNU_array, i = array_len(MNU_array); i > 0; m++, i--)
62 if (!(m->flags & MENU_USED))
63 break;
64 if (i <= 0) {
65 var_append(struct menu, MNU_array, NULL);
66 m = &MNU_array[array_len(MNU_array) - 1];
67 }
68 /* set up m */
69 /* "givens" */
70 m->vid = vid;
71 m->flags = (MENU_DIRTY | MENU_USED | (flags & ALL_MNU_FLAGS));
72 m->hwidth = hcols;
73 m->dwidth = dcols;
74 m->number = total;
75 m->disp = disp;
76 m->arg = arg;
77 m->index = 0;
78 m->hcols = MENU_ALL;
79 m->topline = -2; /* to force complete repaint */
80 if (mcols < 1)
81 mcols = 1;
82 m->ncols = mcols;
83 return m - MNU_array;
84 }