if_init.c revision d67944fbe3fa0b31893a7116a09b0718eecf6078
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#include <stdio.h>
#include <curses.h>
#include <string.h>
#include "wish.h"
#include "fm_mn_par.h"
#include "terror.h"
#include "var_arrays.h"
#include "vtdefs.h"
#include "ctl.h"
#include "attrs.h"
#include "color_pair.h"
#include "moremacros.h"
#include "interrupt.h"
#include "token.h"
#include "slk.h"
/* single instance desriptors in initialization file */
#define INIT_SING_KEYS 28
#define INIT_ONINTR PAR_ONINTR
#define INIT_TITLE 2
#define INIT_TEXT 3
#define INIT_ROWS 4
#define INIT_COLUMNS 5
#define INIT_BANNER 6
#define INIT_BANCOL 7
#define INIT_WORKING 8
#define COL_SCREEN 9
#define COL_BANNER_TEXT 10
#define COL_WINDOW_TEXT 11
#define COL_ACTIVE_BORD 12
#define COL_INACTIVE_BORD 13
#define COL_ACTIVE_TITLE 14
#define COL_ACTIVE_TITLE_BAR 15
#define COL_INACTIVE_TITLE 16
#define COL_INACTIVE_TITLE_BAR 17
#define COL_BAR 18
#define COL_BAR_TEXT 19
#define COL_SLK_BAR 20
#define COL_SLK_TEXT 21
#define COL_FIELD_BAR 22
#define COL_FIELD_TEXT 23
#define INIT_TOGGLE 24
#define INIT_DOUBLEVARS 26
#define INIT_PERMMSG 27
/* Multi-instance descriptors for initialization file */
#define INIT_MULT_KEYS 6
#define SLK_ONINTR PAR_ONINTR
#define SLK_ACTION PAR_ACTION
#define SLK_SHOW 4
#define SLK_BUTTON 5
/* Single-instance descriptors for commands file */
/*
* there is none
*/
#define CMD_SING_KEYS 0
/* Multi-instance descriptors for commands file */
#define CMD_MULT_KEYS 6
#define CMD_ONINTR PAR_ONINTR
#define CMD_ACTION PAR_ACTION
#define CMD_SHOW 4
#define CMD_HELP 5
#define WORKINGMSG "Working"
#define FOURFOUR "4-4"
#define DEFTOGGLE 3
{ "use_incorrect_pre4.0_behavior",
};
/*
* Table for SLKS and CMDS
*/
};
};
bool Doublevars = FALSE;
/*
* By default Doublevars = FALSE.
*
* If "Doublevars == TRUE" then the previously incorrect behavior of
* "re-evaluating" an expanded environment variable will be
* allowed (see eval_dollar() in eval.c for details).
*
* If "Doublevars == FALSE" then variables will be expanded as they
* are in the UNIX shell. In addition, the new construct "$!" will be
* recognized so as to facilitate the "old" behavior. The reason for
* the new construct is that the "old" behavior of variable
* "re-evaluation", though often damaging, is also quite useful.
*
* NOTE: The descriptor "use_incorrect_pre4.0_behavior" was only added
* to avoid "blind-siding" those applications that depend on the "old"
* behavior. Since it is expected that ALL applications conform to the
* "new" behavior in the future, this descriptor will (most likely) be
* ignored by FMLI in post 4.0 releases.
*/
extern int Vflag;
int Border_colors_differ; /* do active/inactive border colors differ? */
/*
* Introductory object attributes
*/
static char *Intro_title;
static char *Intro_text;
static int Intro_rows;
static int Intro_cols;
static char *Bancolstr;
static char *Col_screen;
static char *Col_banner_text;
static char *Col_window_text;
static char *Col_active_bord;
static char *Col_inactive_bord;
static char *Col_active_title;
static char *Col_active_title_bar;
static char *Col_inactive_title;
static char *Col_inactive_title_bar;
static char *Col_bar;
static char *Col_bar_text;
static char *Col_slk_bar;
static char *Col_slk_text;
static char *Col_field_bar;
static char *Col_field_text;
/*
* extern globals
*/
int Work_col;
int Mail_col;
char *strnsave();
static int settoggle();
static char *set_default();
static int center_it();
/*
** Front-end to parser(), which sets up defaults.
*/
int
char *initfile;
{
register int i, numslks;
static int free_inits = FALSE;
int sbutton;
/* if (access(initfile, 04) < 0)
** return; abs k15 */
/* make sure file exists and is readable abs k15 */
mess_temp("error: initialization file missing or not readable");
mess_flash("error: initialization file missing or not readable");
doupdate();
return (0);
}
if (free_inits == TRUE)
else
free_inits = TRUE;
/*
* Parse initialization file
*/
if (initfile)
for (i = 0; i < numslks; i++)
{
{
}
}
/*
* Introductory object info
*/
/*
* Session interrupt info
*/
/*
* BANNER line info
*/
/*
* COLOR specifications
*/
if (Color_terminal == TRUE) {
}
/*
* Miscallaneous global attributes
*/
Doublevars = TRUE;
else
Doublevars = FALSE;
/* set_default(INIT_INTR);
set_default(INIT_ONINTR);
*/
return (0);
}
/*
* SET_DEFAULT determines the value of the appropriate descriptor
* and makes it the new default in the Initialization table.
*/
static char*
int index;
{
char *tmp;
}
int
char *cmdfile;
{
register int i, numcmds;
char *get_def();
/* if (access(cmdfile, 04) < 0)
* return (0);
*/
/* make sure file exists and is readable abs k15 */
{
mess_temp("error: commands file missing or not readable");
mess_flash("error: commands file missing or not readable");
doupdate();
return (0);
}
/*
* Parse commands file
*/
for (i = 0; i < numcmds; i++) {
continue;
/*
* If one of the commands "unix" or "unix-system is disabled
* the other one is disabled automatically.
*/
del_cmd("unix");
else
del_cmd("unix-system");
}
else
}
return (0);
}
/*
* SETTOGGLE will determine the number of choices that must be present
* for a form field before a choices "menu" is generated.
*/
static int
char *str;
{
int threshold;
threshold = 0;
return(threshold);
}
#define COL_STRSIZE 40
/*
* SET_DEF_COLORS initializes the color attributes
*/
int
{
static int refresh_scr = TRUE;
if (!Color_terminal)
return (0);
refresh_scr = FALSE;
else
return (0);
}
/*
* SET_DEF_STATUS initializes the status (banner) line
*/
int
{
int r, c, bancol;
if (Vflag) {
Mail_col = 0;
}
if (!Work_msg)
if (Banner) {
else
bancol = c;
wclrwin();
}
return (0);
}
/*
* GET_DESC_VAL scans the filename for the "target" descriptor ...
* Though the function is generic, its primary use is the "slk_layout"
* descriptor in the Initialization file....
* Unfortunately this descriptor has to be evaluated BEFORE curses
* is ever initialized, therefore, it must be accounted for before the
* Initialization file is parsed completely.
*/
char *
char *filename;
char *descname;
{
int evalflags;
char *ptr, *eval_string();
return(retstr);
}
*ptr = '\0';
break;
}
}
}
return(retstr);
}
/*
* COPYRIGHT puts up the initial text object which can be customized by
* the application (e.g., FACE puts up a copyright notice)
*/
{
char *text;
text = Intro_text;
}
else
vt_flush();
sleep(2);
return(vid);
}
static int
char *str;
{
int r, c;
int datecol;
int s;
if (s < c)
datecol = (c - s) / 2;
else
datecol = 0;
return(datecol);
}
/* init_ctl
return value of initialization desriptors
implemented as minimal routine for values currently needed.
expand as needed if more complex situation need to be handled.
*/
char *
unsigned int cmd;
{
switch(cmd)
{
case CTGETINTR:
return("false"); /* default behavior */
else
return(Intr);
break;
case CTGETONINTR:
return(DEF_ONINTR);
else
return(Onintr);
break;
default:
return((char *)FAIL);
}
}