slk.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, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* microsecond delay timer not available before SVR4.0 abs k18 */
#ifdef PRE_SVR4_COMPILE
#define DO_NOT_DELAY
#endif
#include <stdio.h>
#include <curses.h>
#include <term.h>
#include <string.h> /* abs k17 */
#include <unistd.h> /* abs k18 */
#include <stdlib.h> /* abs k18 */
#ifndef DO_NOT_DELAY
#endif
#include "wish.h"
#include "token.h"
#include "fm_mn_par.h"
#include "slk.h"
#include "ctl.h"
#include "moremacros.h"
#include "interrupt.h"
};
};
};
};
#define MARK 1
};
};
};
/*
* FACE user interface Directory SLKS
*/
};
extern int Browse_mode;
/*
* FACE user interface Browse Mode SLKS
*/
};
static int SLK_level = 0;
static void showslks();
static bool sfk_prompt();
extern int Vflag;
/*
* init_sfk tries to initialize the screen function keys for terminals
* (like the att630) which do not have pre-defined screen function keys
* It will not do anything if:
* 1) the environment variable LOADPFK is set to anything other than
* yes, true, or the null string (case insensitive) or
* 2) the terminal does not support software downloading of these strings or
* 3) if the terminal has predefined strings sent by the function keys.
* 4) if, when prompted, the user responds with anything other than
* "yes", "y", or "" (whitespace & extra words ignored.) Prompt only occurs
* once per session and only if LOADPFK is not defined.
*
* NOTE: if the terminfo entry indicates a mandatory delay is needed
* and there is no pad char then FMLI will insert the delay.
* For some terminals (ex dmd 5620) this delay is appreciable
* and should be avoided, when feasable, by downloading once then
* setting LOADPFK=no.
* IMPORTANT: remove the delay code (ifdef'd by DO_NOT_DELAY)
* when curses gets smart enough to do delays right for
* terminals like the dmd 5620 which do not have pad characters
*/
int
bool do_prompt; /* abs k18 */
{
char sequence[3];
int i;
#ifndef DO_NOT_DELAY
char *sub_str;
char *end_str; /* abs k18 */
unsigned time_left; /* abs k18 */
static long Mandatory_delay = 0L; /* abs k18 */
#endif
char *load; /* abs k18 */
/* if we already prompted user and they said no then don't do anything */
return (0); /* abs k18 */
/* if LOADPFK is set in the environment, don't download function keys,
* unless it is set to yes, true, or the null string. abs k18
*/
return (0); /* user says don't mess with my keys! */
if (load)
return (0);
#ifndef DO_NOT_DELAY
{
First_time = FALSE;
if (no_pad_char) /* can't create delay by sending pads */
{
/* look for mandatory delay
* delays are coded $<nnn/> where n is a digit and
* the slash, if present, means the delay is mandatory.
*/
if (*(++sub_str) == '<')
{
Mandatory_delay = 0L;
}
if (Mandatory_delay)
{
/* convert milliseconds to microseconds and seconds.
* tv_usec must be less than 1,000,000. abs k18.2
*/
}
}
}
/* don't want mailcheck to intefere with timer. abs k18 */
#endif
* keys 2 - 8 not pre-defined either */
{
return (0); /* abs k18 */
/* The following line was moved from below. This is where it belongs,
** unfortunately the doupdate() to make the indicator visible
** interferes with downloading 5620 pfk's (somehow?!) depending on whats
** in the curses screen buffer. abs k18.2
** working(TRUE);
*/
for (i = 1; i < 9; i++)
{
#ifndef DO_NOT_DELAY
if (Mandatory_delay) /* abs k18 */
{
pause(); /* abs k18 */
}
#endif
}
}
else
{
{
return (0); /* abs k18 */
else /* abs k18 */
#ifndef DO_NOT_DELAY
if (Mandatory_delay) /* abs k18 */
{
pause(); /* abs k18 */
}
#endif
}
{
return (0); /* abs k18 */
else /* abs k18 */
#ifndef DO_NOT_DELAY
if (Mandatory_delay) /* abs k18 */
{
pause(); /* abs k18 */
}
#endif
}
{
return (0); /* abs k18 */
else /* abs k18 */
#ifndef DO_NOT_DELAY
if (Mandatory_delay) /* abs k18 */
{
pause(); /* abs k18 */
}
#endif
}
{
return (0); /* abs k18 */
else /* abs k18 */
#ifndef DO_NOT_DELAY
if (Mandatory_delay) /* abs k18 */
{
pause(); /* abs k18 */
}
#endif
}
{
return (0); /* abs k18 */
else /* abs k18 */
#ifndef DO_NOT_DELAY
if (Mandatory_delay) /* abs k18 */
{
pause(); /* abs k18 */
}
#endif
}
{
return (0); /* abs k18 */
else /* abs k18 */
#ifndef DO_NOT_DELAY
if (Mandatory_delay) /* abs k18 */
{
pause(); /* abs k18 */
}
#endif
}
{
return (0); /* abs k18 */
else /* abs k18 */
#ifndef DO_NOT_DELAY
if (Mandatory_delay) /* abs k18 */
{
pause(); /* abs k18 */
}
#endif
}
}
#ifndef DO_NOT_DELAY
#endif
return (0);
}
static bool
{
char raw_input[80];
int cursor, x, y;
flushinp();
wprintw(win, "This terminal does not have usable default settings for its function keys;\nhowever, this application can download usable settings.\n\nIf you reply yes, function keys will work, BUT any values you may already \nhave programmed into them will be overwritten.\n\n");
wprintw(win, "If you reply no, function keys may not work, and you must use CTRL-f1 \nthru CTRL-f8 to simulate the function keys.\n\nThis prompt will not occur if you set LOADPFK=YES or LOADPFK=NO in \nyour environment.\n\nDownload usable settings into the function keys [default is yes]? ");
echo();
noecho();
response++;
word_end++; /* abs k18.2 */
{
return(TRUE); /* said no */
}
else
{
return(FALSE); /* said yes */
}
}
/*
* SETUP_SLK_ARRAY will initialize defaults for the SLKS
*/
int
{
register int i, j;
for (i = 0; i < SECOND_LEVEL; i++)
for (i = SECOND_LEVEL; i < MAX_SLKS; i++) {
}
return (0);
}
static void showslks();
/*
* SETSLKS will make "slks" the currently displayed SLKS
*/
void
int flag;
{
register int i, more_slks;
#ifdef _DEBUG
#endif
if (Vflag) { /* FACE specific slks */
if (Browse_mode)
else
}
else { /* use menu slks by default */
}
return;
}
#ifdef _DEBUG
#endif
SLK_level = -1;
slk_clear();
return;
}
more_slks = 0;
more_slks++;
#ifdef _DEBUG
#endif
}
#ifdef _DEBUG
#endif
while (i < MAX_SLKS)
}
int Refresh_slks = 0;
/*
* SHOWSLKS will do the actial displaying
*/
static void
int flag;
{
register int i;
register int j;
if (SLK_level < 0) {
Refresh_slks++;
/*slk_restore(); defer to vt_flush() */
}
if (flag)
SLK_level = j = SECOND_LEVEL;
else
SLK_level = j = 0;
for (i = 1; i <= SECOND_LEVEL; i++)
}
/*
* SLK_TOKEN will determine the token action for a given SLK
*/
slk_token(t)
token t;
{
register int n;
int flags;
char **arglist, **eval_string();
#ifdef _DEBUG
_debug(stderr, "slk %d is labeled '%s' and returns token %d\n", t, SLK_array[n].label,SLK_array[n].tok);
#endif
{
else
{
/* update the interrupt structures based on
the values for the current slk, if defined
else with the inherited values.
*/
return(make_action(arglist));
}
}
return TOK_BADCHAR;
}
int
{
register int i;
for (i = 0; i < SECOND_LEVEL; i++)
return (0);
}
/*
* SET_OBJ_SLK is called by objects that wish to redefine the
* GLOBAL default SLKS ...
* The object will pass a "slktok" in the range SLK1 - SLK16.
* If a token in this range is "caught" by the object,
* the object itself will determine the appropriate action.
*/
int
char *label;
int slktok;
{
int slknum;
}
else {
/*
* unfortunately this test needs to be made ...
* (if odsh gets prevpage or nextpage its too late)
* We must search for a better way !!!
*/
else
}
else { /* must use the defaults! */
}
}
return (0);
}
/*
* SET_DEF_SLK will over-write the GLOBAL default SLKS
*/
int
int slknum;
char *label;
char *action;
{
/*
* if less then CHG_KEYS do nothing (can't redefine first level)
*/
}
}
/*
* if SLK is at the first level, then change the object
* SLKS to reflect the redefined or disabled SLK
*/
}
return (0);
}
/*
* SLK_TOGGLE will toggle the currently displayed SLKS
*/
int
slk_toggle(void)
{
return (0);
}
int
int flag;
{
else
return (0);
}