/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* Copyright (c) 1981 Regents of the University of California */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ex.h"
#include "ex_tty.h"
static unsigned char *freespace;
/*
* Terminal type initialization routines,
* and calculation of flags at entry or after
* a shell escape which may change them.
*/
static short GT;
void
gettmode(void)
{
short speed;
GT = 1;
return;
if (termiosflag)
else
GT = 0;
}
void
{
char *tparm();
unsigned char *chrptr;
int unknown, i;
int l;
int errret;
extern unsigned char termtype[];
extern void setsize();
unknown = 0;
if (cur_term && exit_ca_mode)
putpad((unsigned char *)exit_ca_mode);
/*
* The code in this if statement is from 4.1.2 and fixes a bug where
* you couldn't change the term type using the ":set term" command.
*/
if (*termtype) {
#ifdef TRACE
#endif
* previously (this is a set command)
*/
}
cur_term = 0;
#ifdef XPG4
#endif /* XPG4 */
if (errret != 1) {
unknown++;
cur_term = 0;
if (errret == 0) {
if (errret == 0) {
}
}
else if (errret == -1) {
}
}
if (errret == 1)
resetterm();
#ifdef TRACE
if (trace) fprintf(trace, "after setupterm, lines %d, columns %d, clear_screen '%s', cursor_address '%s'\n", lines, columns, clear_screen, cursor_address);
#endif
setsize();
#ifdef OLD
#endif
exit_bold = (exit_standout_mode ? exit_standout_mode : (exit_attribute_mode ? exit_attribute_mode : 0));
i = lines;
if (lines <= 1)
lines = 24;
l = lines;
l = 9; /* including the message line at the bottom */
l = 17;
if (l > lines)
l = lines;
/*
* Initialize keypad arrow keys.
*/
#ifdef sun
(unsigned char *)"inschar");
(unsigned char *)"inschar");
(unsigned char *)"up");
(unsigned char *)"down");
(unsigned char *)"left");
(unsigned char *)"right");
(unsigned char *)"home");
#else
#endif /* sun */
/*
* Handle funny termcap capabilities
*/
/* don't understand insert mode with multibyte characters */
if(MB_CUR_MAX > 1) {
#ifndef PRESUNEUC
#endif /* PRESUNEUC */
}
if (GT == 0)
#ifdef SIGTSTP
/*
* Now map users susp char to ^Z, being careful that the susp
* overrides any arrow key, but only for hackers (=new tty driver).
*/
{
int i;
sc[1] = 0;
for (i=0; i<=4; i++)
} else if(sc[0])
}
}
#endif
if (defwind)
if (columns <= 4)
columns = 1000;
cursor_address = 0;
else
if (i <= 0)
lines = 2;
/* proper strings to change tty type */
termreset();
gettmode();
if (unknown)
type);
}
#ifndef sun
/*
* Map both map1 and map2 as below. map2 surrounded by esc and
* the 'i', 'R', or 'a' mode. However, because we don't know
* the mode here we put in the escape and when the map() routine
* is called for immacs mapping the mode is appended to the
* macro. Therefore when you leave insert mode, to perform a
* function key, it will (once the cursor movement is done)
* restore you to the proper mode.
*/
{
unsigned char *p;
if (key == 0)
return;
return;
p = freespace;
}
#endif /* !sun */
/*
* Define a macro. mapstr is the structure (mode) in which it applies.
* key is the input sequence, mapto what it turns into, and desc is a
* human-readable description of what's going on.
*/
void
unsigned char *desc)
{
int i;
for (i=0; i<MAXNOMACS; i++)
break;
return;
}
unsigned char *
fkey(i)
int i;
{
if (i < 0 || i > 9)
return ((unsigned char *)NOSTR);
switch (i) {
case 0: return ((unsigned char *)key_f0);
case 1: return ((unsigned char *)key_f1);
case 2: return ((unsigned char *)key_f2);
case 3: return ((unsigned char *)key_f3);
case 4: return ((unsigned char *)key_f4);
case 5: return ((unsigned char *)key_f5);
case 6: return ((unsigned char *)key_f6);
case 7: return ((unsigned char *)key_f7);
case 8: return ((unsigned char *)key_f8);
case 9: return ((unsigned char *)key_f9);
case 10: return ((unsigned char *)key_f0);
}
return ((unsigned char *)NOSTR);
}
/*
* cost figures out how much (in characters) it costs to send the string
* str to the terminal. It takes into account padding information, as
* much as it can, for a typical case. (Right now the typical case assumes
* the number of lines affected is the size of the screen, since this is
* mainly used to decide if insert_line or scroll_reverse is better, and this always happens
* at the top of the screen. We assume cursor motion (cursor_address) has little
* padding, if any, required, so that case, which is really more important
* than insert_line vs scroll_reverse, won't be really affected.)
*/
static int costnum;
/* ARGSUSED */
int
{
costnum++;
return (0);
}
int
{
return 10000; /* infinity */
costnum = 0;
return costnum;
}