コード例 #1
0
ファイル: shell.c プロジェクト: nysan/alpine
/* 
 * rtfrmshell - back from shell, fix modes and return
 */
RETSIGTYPE
rtfrmshell(int sig)
{
    signal(SIGCONT, SIG_DFL);
    ttopen();
    ttresize();
    pclear(0, term.t_nrow);
    pico_refresh(0, 1);
}
コード例 #2
0
ファイル: spawn.c プロジェクト: axelmuhr/Helios-NG
spawncli(f, n)
{
       fortran void comlv$();
       ttcolor(CTEXT);
       ttnowindow();
       ttmove(nrow-1, 0);
       if (epresf != FALSE) {
	       tteeol();
	       epresf = FALSE;
       }
       ttclose();
       comlv$();
       sgarbf = TRUE;		/* Force repaint.	*/
       ttopen();
#ifndef NO_DIR
       (void) dirinit();	/* current directory may have changed */
#endif
       return (TRUE);
}
コード例 #3
0
Dpause()
{
#ifdef hpux
	return FALSE;
#else
#if BSDUNIX || LINUX
	extern int sgarbf;
	(*term.t_move)( term.t_nrow - 1, 0 );
	(*term.t_eeop)();
	ttflush();
	ttclose();
	killpg(getpgrp(0), 18);	/* SIGTSTP -- stop the current program */
	ttopen();
	sgarbf = TRUE;
	window_refresh(FALSE, 1);
#endif
	return( TRUE );
#endif
}
コード例 #4
0
ファイル: spawn.c プロジェクト: sarami55/ng-.1.5
/*ARGSUSED*/
spawncli(f, n) {
	register void	(*oisig)();
	int		status;
#ifdef	EXTD_DIR
	ensurecwd();
#endif

	if (shellp == NULL) {
		shellp = getenv("SHELL");
		if (shellp == NULL)
			shellp = getenv("shell");
		if (shellp == NULL)
			shellp = "command.x";	/* Safer.		*/
	}
	ttcolor(CTEXT);
	ttnowindow();
	ttmove(nrow-1, 0);
	if (epresf != FALSE) {
		tteeol();
		epresf = FALSE;
	}
	ttclose();
	sgarbf = TRUE;				/* Force repaint.	*/
	oisig = signal(SIGINT,  SIG_IGN);
#ifdef	EXTD_DIR
	dirend();
#endif
	if (spawnlp(P_WAIT, shellp, shellp, NULL) == -1) {
		status = FALSE;
	} else {
		status = TRUE;
	}
	(VOID) signal(SIGINT,  oisig);
	ttopen();
	if(status == FALSE) {
		ewprintf("Failed to run %s", shellp);
		sleep(2);		/* Show this message for 2 sec	*/
					/* before refresh screen.	*/
	}
	dirinit();
	return (status);
}
コード例 #5
0
/***
 *  smgopen  -  Get terminal type and open terminal
 *
 *  Nothing returned
 ***/
smgopen()
{
	static int first_time = 1;
	
	/* Open channel to terminal (also sets sizes in TERM structure) */
	ttopen();

	/* Get SMG */
	if (first_time)
	{
		first_time = 0;
		if (smgcap())
			meexit( 1);
	}

#if	KEYPAD
	smgputs(applic_keypad);
#endif
#ifdef NEVER
	smgputs( begin_mouse);
#endif
}
コード例 #6
0
ファイル: ansi.c プロジェクト: ytoto/uemacs
void ansiopen(void)
{
#if     V7 | USG | BSD
	char *cp;

	if ((cp = getenv("TERM")) == NULL) {
		puts("Shell variable TERM not defined!");
		exit(1);
	}
	if (strcmp(cp, "vt100") != 0) {
		puts("Terminal type not 'vt100'!");
		exit(1);
	}
#endif
#if WINNT
	xstrcpy(sres, "WINNT");
#else
	xstrcpy(sres, "NORMAL");
#endif
	revexist = TRUE;
	ttopen();
}
コード例 #7
0
ファイル: display.c プロジェクト: bloovis/micro-emacs
/*
 * Initialize the data structures used
 * by the display code. The edge vectors used
 * to access the screens are set up. The operating
 * system's terminal I/O channel is set up. Fill the
 * "blanks" array with ASCII blanks. The rest is done
 * at compile time. The original window is marked
 * as needing full update, and the physical screen
 * is marked as garbage, so all the right stuff happens
 * on the first call to redisplay.
 */
void
vtinit (void)
{
  register VIDEO *vp;
  register int i;

  ttopen ();
  ttinit ();
  vp = &video[0];
  for (i = 0; i < NROW - 1; ++i)
    {
      vscreen[i] = vp;
      ++vp;
#if	MEMMAP
      /* don't need pscreen */
#else
      pscreen[i] = vp;
      ++vp;
#endif
    }
  blanks.v_color = CTEXT;
  memset (blanks.v_text, ' ', NCOL);
}
コード例 #8
0
ファイル: terminal.c プロジェクト: nysan/alpine
static int
tinfoopen(void)
{
    int     row, col;

    /*
     * determine the terminal's communication speed and decide
     * if we need to do optimization ...
     */
    if(ttisslow())
      term_capabilities |= TT_OPTIMIZE;
    
    col = _tcolumns;
    row = _tlines;
    if(row >= 0)
      row--;

    ttgetwinsz(&row, &col);
    term.t_nrow = (short) row;
    term.t_ncol = (short) col;

    if(_cleartoeoln != NULL)	/* able to use clear to EOL? */
      term_capabilities |= TT_EOLEXIST;
    else
      term_capabilities &= ~TT_EOLEXIST;

    if(_setinverse != NULL)
      term_capabilities |= TT_REVEXIST;
    else
      term_capabilities &= ~TT_REVEXIST;

    if(_deletechar == NULL && (_startdelete == NULL || _enddelete == NULL))
      term_capabilities &= ~TT_DELCHAR;

    if(_insertchar == NULL && (_startinsert == NULL || _endinsert == NULL))
      term_capabilities &= ~TT_INSCHAR;

    if((_scrollregion == NULL || _scrolldown == NULL || _scrollup == NULL)
       && (_deleteline == NULL || _insertline == NULL))
      term_capabilities &= ~TT_SCROLLEXIST;

    if(_clearscreen == NULL || _moveto == NULL || _up == NULL){
	if(Pmaster == NULL){
	    puts("Incomplete terminfo entry\n");
	    exit(1);
	}
    }

    ttopen();

    if(_termcap_init && !Pmaster) {
	putpad(_termcap_init);		/* any init terminfo requires */
	if (_scrollregion)
	  putpad(tgoto(_scrollregion, term.t_nrow, 0)) ;
    }

    /*
     * Initialize UW-modified NCSA telnet to use its functionkeys
     */
    if((gmode & MDFKEY) && Pmaster == NULL)
      puts("\033[99h");

    /* return ignored */
    return(0);
}
コード例 #9
0
ファイル: terminal.c プロジェクト: nysan/alpine
int
ansiopen(void)
{
        ttopen();
}
コード例 #10
0
ファイル: main.c プロジェクト: Ntools/n
int main(int argc,char *argv[])
{
	register int i;
	int st, read_only;
	char *sp;
	extern char *ininame;
	int batch(char *,char *);
	void help(int);

	st= 0;
#ifdef __386__
	fprintf(stderr, "Nobby's Editor Version %s\n"
	"Copyright (c) Nobby N. Hirano 1990-94\n", VERSION);
#endif
#ifdef TEXT98
	lastdisplay= 24;
	displaylen = 80;
#endif
#ifdef DOSV
	lastdisplay= 0;
	displaylen = 0;
#endif
	read_only = beut_flg = OFF;
	meminit();
	keycount();
	tool();
	initdefkey();
	for(i=1;i < argc;++i) {
		sp= argv[i];
		if(*sp == '-') {
			sp= argv[i]+1;
			while(*sp != '\0') {
				switch(toupper(*sp)) {          /* to lower case */
					case 'B' : back_flg= ON; ++sp; break;
					case 'E' : bat_flg= OFF; ++sp; break;
#if (defined TEXT98)
					case 'H' : beut_flg= ON; ++sp; break;
					case 'N' : beut_flg= OFF; ++sp; break;
#endif
					case 'L' :
					++sp;
					if(*sp == '=') ++sp;
					if((lastdisplay= atoi(sp)) != 0) {
						while(isdigit(*sp)) ++sp;
						break;
					}
					fprintf(stderr,"Unknow option '%s' !\n",sp);
					help(1);
					case 'V' :
					fprintf(stderr,"Copyright (c) Nobby N. Hirano 1990 - 94 All rights reserved.\r\n"
#if (defined TEXT98)
					"Version 5.0  %s  for PC9801 & PC-286,386 i80286,386,486.\n"
#elif (defined ATVRAM)
# ifdef __386__
					"Version %s %s  for PC-DOS MS-DOS J5.0/V, J6.x/V DPMI Version.\n", VERSION
# else
					"Version 6.0  %s  for PC-DOS MS-DOS J5.0/V, J6.x/V.\n"
# endif
#elif (defined DOSV)
					"Version 5.0  %s  for PC-AT, its Compatible and J3100.\n"
#elif (defined UNIX)
					"Version 1.1.0  %s  for UNIX.\r\n"
#endif
					,__DATE__);
					exit(1);
					case 'M' :
					++sp;
					execinitbl= ON;
					break;
					case 'R' :
					++sp;
					read_only = ON;
					break;
					case '?':
					help(0);
					case 'S' :
					++sp;
					if(*sp == '=') ++sp;
					if((tabs= atoi(sp)) != 0) {
						tabset= ON;
						while(isdigit(*sp)) ++sp;
						break;
					}
					default :
					fprintf(stderr,"Unknow option '%s' !\n",sp);
					help(1);
				}
			}
		}
		else {
			++st;
			arg_flg = ON;
		}
	}
	if(execinitbl) {
		printf("Write Key command tablefile to [keys.ini].\n");
		toolwrite("keys.ini");
		exit(0);
	}
#ifdef UNIX
	system("stty -icanon -echo intr ^T");
	ttopen();
#endif
#if defined(TEXT98)
	pushscrn();
#elif !defined(ATVRAM) && !defined(UNIX)
	batch(NULL,"///");
#endif
#if defined(ATVRAM)
	vtopen();
#elif defined(DOSV)
	if(!lastdisplay) {
	lastdisplay= *((unsigned char __far *)
# ifdef __386__
	MK_FP(0x40, 0x84));
# else
	0x400084);
#endif
	if(lastdisplay < 24) lastdisplay = 24;
}
コード例 #11
0
static void
tcapopen(void)
{
	char *t, *p;
	char tcbuf[2048];
	char *tv_stype;
	char err_str[72];
	int i, j;
	static int already_open = 0;

	static const struct {
		char *name;
		char **data;
	} tc_strings[] = {
		 { "AL", &AL }		/* add p1 lines above cursor */
		,{ "DL", &DL }		/* delete p1 lines, begin at cursor */
		,{ "al", &al }		/* add line below cursor */
		,{ "ce", &CE }		/* clear to end of line */
		,{ "cl", &CL }		/* clear screen, cursor to home */
		,{ "cm", &CM }		/* move cursor to row p1, col p2 */
		,{ "cs", &CS }		/* set scrolling to rows p1 .. p2 */
		,{ "dl", &dl }		/* delete line */
		,{ "ke", &KE }		/* end keypad-mode */
		,{ "ks", &KS }		/* start keypad-mode */
		,{ "se", &SE }		/* end standout-mode */
		,{ "sf", &SF }		/* scroll forward 1 line */
		,{ "so", &SO }		/* start standout-mode */
		,{ "sr", &SR }		/* scroll reverse 1 line */
		,{ "te", &TE }		/* end cursor-motion program */
		,{ "ti", &TI }		/* initialize cursor-motion program */
#if	OPT_COLOR
		,{ "AF", &Sf }		/* set ANSI foreground-color */
		,{ "AB", &Sb }		/* set ANSI background-color */
		,{ "Sf", &Sf }		/* set foreground-color */
		,{ "Sb", &Sb }		/* set background-color */
		,{ "op", &orig_colors }	/* set to original color pair */
		,{ "oc", &orig_colors }	/* set to original colors */
#endif
#if	OPT_FLASH
		,{ "vb", &vb }		/* visible bell */
#endif
#if	OPT_VIDEO_ATTRS
		,{ "me", &ME }		/* turn off all attributes */
		,{ "md", &MD }		/* turn on bold attribute */
		,{ "us", &US }		/* underline-start */
		,{ "ue", &UE }		/* underline-end */
#endif
	};

	if (already_open) 
		return;

	if ((tv_stype = getenv("TERM")) == NULL)
	{
		puts("Environment variable TERM not defined!");
		ExitProgram(BADEXIT);
	}

	if ((tgetent(tcbuf, tv_stype)) != 1)
	{
		(void)lsprintf(err_str, "Unknown terminal type %s!", tv_stype);
		puts(err_str);
		ExitProgram(BADEXIT);
	}

	/* Get screen size from system, or else from termcap.  */
	getscreensize(&term.t_ncol, &term.t_nrow);
 
	if ((term.t_nrow <= 1) && (term.t_nrow=(short)tgetnum("li")) == -1) {
		term.t_nrow = 24;
	}

	if ((term.t_ncol <= 1) &&(term.t_ncol=(short)tgetnum("co")) == -1){
		term.t_ncol = 80;
	}

	/* are we probably an xterm?  */
	p = tcbuf;
	i_am_xterm = FALSE;
	if (strncmp(tv_stype, "xterm", sizeof("xterm") - 1) == 0) {
		i_am_xterm = TRUE;
		x_origin = 0;
		y_origin = 0;
	}
	else
		while (*p && *p != ':') {
			if (*p == 'x' 
			    && strncmp(p, "xterm", sizeof("xterm") - 1) == 0) {
				i_am_xterm = TRUE;
				x_origin = 0;
				y_origin = 0;
				break;
			}
			p++;
		}

	term.t_mrow =  term.t_nrow;
	term.t_mcol =  term.t_ncol;

	p = tcapbuf;
	for (i = 0; i < TABLESIZE(tc_strings); i++) {
		/* allow aliases */
		if (*(tc_strings[i].data) == 0)
		    *(tc_strings[i].data) = tgetstr(tc_strings[i].name, &p);
	}

#if HAVE_EXTERN_TCAP_PC
	t = tgetstr("pc", &p);
	if(t)
		PC = *t;
#endif

	if (SO != NULL)
		revexist = TRUE;

	if(CL == NULL || CM == NULL)
	{
		puts("Incomplete termcap entry\n");
		ExitProgram(BADEXIT);
	}

	if (CE == NULL) 	/* will we be able to use clear to EOL? */
		eolexist = FALSE;

	if (!CS || !SR) { /* some xterm's termcap entry is missing entries */
		if (i_am_xterm) {
			if (!CS) CS = "\033[%i%d;%dr";
			if (!SR) SR = "\033[M";
		}
	}

	if (CS && SR) {
		if (SF == NULL) /* assume '\n' scrolls forward */
			SF = "\n";
		term.t_scroll = tcapscroll_reg;
	} else if ((DL && AL) || (dl && al)) {
		term.t_scroll = tcapscroll_delins;
	} else {
		term.t_scroll = null_t_scroll;
	}
#if	OPT_COLOR
	if (orig_colors == 0)
		orig_colors = tgetstr("me", &p);
	set_palette(initpalettestr);
#endif
#if OPT_VIDEO_ATTRS
	if (US == 0 && UE == 0) {	/* if we don't have underline, do bold */
		US = MD;
		UE = ME;
	}
#endif

	for (i = TABLESIZE(keyseqs); i--; ) {
	    char *seq = tgetstr(keyseqs[i].capname, &p);
	    if (seq) {
		int len;
#define DONT_MAP_DEL 1
#if DONT_MAP_DEL
		/* NetBSD, FreeBSD, etc. have the kD (delete) function key
		    defined as the DEL char.  i don't like this hack, but
		    until we (and we may never) have separate system "map"
		    and "map!" maps, we can't allow this -- DEL has different
		    semantics in insert and command mode, whereas KEY_Delete
		    has the same semantics (whatever they may be) in both. 
		    KEY_Delete is the only non-motion system map, by the
		    way -- so the rest are benign in insert or command
		    mode.  */
		if (strcmp(seq,"\177") == 0)
		    continue;
#endif
		addtosysmap(seq, len = strlen(seq), keyseqs[i].code);
		/*
		 * Termcap represents nulls as octal 200, which is ambiguous
		 * (ugh).  To avoid losing escape sequences that may contain
		 * nulls, check here, and add a mapping for the strings with
		 * explicit nulls.
		 */
#define TCAP_NULL '\200'
		if (strchr(seq, TCAP_NULL) != 0) {
		    char temp[BUFSIZ];
		    (void)strcpy(temp, seq);
		    for (j = 0; j < len; j++)
			if (char2int(temp[j]) == TCAP_NULL)
			    temp[j] = '\0';
		    addtosysmap(temp, len, keyseqs[i].code);
		}
	    }
	}
#if OPT_XTERM
	addtosysmap("\033[M", 3, KEY_Mouse);
#if OPT_XTERM >= 3
	addtosysmap("\033[t", 3, KEY_text);
	addtosysmap("\033[T", 3, KEY_textInvalid);
#endif
#endif
	        
	if (p >= &tcapbuf[TCAPSLEN])
	{
		puts("Terminal description too big!\n");
		ExitProgram(BADEXIT);
	}
	ttopen();
	already_open = TRUE;
}
コード例 #12
0
ファイル: tcap.c プロジェクト: axelmuhr/Helios-NG
tcapopen()

{
        char *getenv();
        char *t, *p, *tgetstr();
        char tcbuf[1024];
        char *tv_stype;
        char err_str[72];

        if ((tv_stype = getenv("TERM")) == NULL)
        {
                puts("Environment variable TERM not defined!");
                exit(1);
        }

        if ((tgetent(tcbuf, tv_stype)) != 1)
        {
                sprintf(err_str, "Unknown terminal type %s!", tv_stype);
                puts(err_str);
                exit(1);
        }

 
       if ((term.t_nrow=(short)tgetnum("li")-1) == -1){
               puts("termcap entry incomplete (lines)");
               exit(1);
       }
	term.t_mrow =  term.t_nrow;

       if ((term.t_ncol=(short)tgetnum("co")) == -1){
               puts("Termcap entry incomplete (columns)");
               exit(1);
       }
	term.t_mcol = term.t_ncol;

        p = tcapbuf;
        t = tgetstr("pc", &p);
        if(t)
                PC = *t;

        CL = tgetstr("cl", &p);
        CM = tgetstr("cm", &p);
        CE = tgetstr("ce", &p);
        UP = tgetstr("up", &p);
	SE = tgetstr("se", &p);
	SO = tgetstr("so", &p);
	if (SO != NULL)
		revexist = TRUE;
#if	FIXSG & REVSTA
	SG = tgetnum("sg");	/* standout glitch 	*/
#endif

        if(CL == NULL || CM == NULL || UP == NULL)
        {
                puts("Incomplete termcap entry\n");
                exit(1);
        }

	if (CE == NULL)		/* will we be able to use clear to EOL? */
		eolexist = FALSE;
		
        if (p >= &tcapbuf[TCAPSLEN])
        {
                puts("Terminal description too big!\n");
                exit(1);
        }
        ttopen();
}
コード例 #13
0
ファイル: tcap.c プロジェクト: k0gaMSX/uemacs
static void tcapopen(void)
{
	char *t, *p;
	char tcbuf[1024];
	char *tv_stype;
	char err_str[72];
	int int_col, int_row;

        if ((tv_stype = getenv("TERM")) == NULL) {
                puts("Environment variable TERM not defined!");
                exit(1);
        }

        if ((tgetent(tcbuf, tv_stype)) != 1) {
                sprintf(err_str, "Unknown terminal type %s!",
                        tv_stype);
                puts(err_str);
                exit(1);
        }

        /* Get screen size from system, or else from termcap.  */
        getscreensize(&int_col, &int_row);
        term.t_nrow = int_row - 1;
        term.t_ncol = int_col;

        if ((term.t_nrow <= 0)
            && (term.t_nrow = (short) tgetnum("li") - 1) == -1) {
                puts("termcap entry incomplete (lines)");
                exit(1);
        }

        if ((term.t_ncol <= 0)
            && (term.t_ncol = (short) tgetnum("co")) == -1) {
                puts("Termcap entry incomplete (columns)");
                exit(1);
        }
#ifdef SIGWINCH
        term.t_mrow = MAXROW;
        term.t_mcol = MAXCOL;
#else
        term.t_mrow = term.t_nrow > MAXROW ? MAXROW : term.t_nrow;
        term.t_mcol = term.t_ncol > MAXCOL ? MAXCOL : term.t_ncol;
#endif
        p = tcapbuf;
        t = tgetstr("pc", &p);
        if (t)
                PC = *t;
        else
                PC = 0;

        CL = tgetstr("cl", &p);
        CM = tgetstr("cm", &p);
        CE = tgetstr("ce", &p);
        UP = tgetstr("up", &p);
        SE = tgetstr("se", &p);
        SO = tgetstr("so", &p);
        if (SO != NULL)
                revexist = TRUE;

        if (tgetnum("sg") > 0) {	/* can reverse be used? P.K. */
                revexist = FALSE;
                SE = NULL;
                SO = NULL;
        }
        TI = tgetstr("ti", &p);	/* terminal init and exit */
        TE = tgetstr("te", &p);

        if (CL == NULL || CM == NULL || UP == NULL) {
                puts("Incomplete termcap entry\n");
                exit(1);
        }

        if (CE == NULL)	/* will we be able to use clear to EOL? */
                eolexist = FALSE;
#if SCROLLCODE
        CS = tgetstr("cs", &p);
        SF = tgetstr("sf", &p);
        SR = tgetstr("sr", &p);
        DL = tgetstr("dl", &p);
        AL = tgetstr("al", &p);

        if (CS && SR) {
                if (SF == NULL)	/* assume '\n' scrolls forward */
                        SF = "\n";
                term.t_scroll = tcapscroll_reg;
        } else if (DL && AL) {
                term.t_scroll = tcapscroll_delins;
        } else {
                term.t_scroll = NULL;
        }
#endif

        if (p >= &tcapbuf[TCAPSLEN]) {
                puts("Terminal description too big!\n");
                exit(1);
        }
	ttopen();
}
コード例 #14
0
ファイル: spawn.c プロジェクト: sarami55/ng-.1.5
/*ARGSUSED*/
spawncli(f, n)
{
	extern char	*strrchr();
	register int	pid;
	register int	wpid;
	register VOID	(*oqsig)();
	register VOID	(*oisig)();
#ifdef	ADDFUNC		/* 93.07.08  by S.Yoshida */
#ifdef	SIGWINCH	/* 93.07.08  by S.Yoshida */
	register VOID	(*owsig)();
#endif
#ifdef	SIGTSTP	/* 93.07.08  by S.Yoshida */
	register int	omask;
#endif
#endif	/* ADDFUNC */
	int		status = FALSE;
	int		errp = FALSE;

#ifdef XKEYS  /* 92.03.16 by Gen KUROKI */
	ttykeymaptidy();
#endif /* XKEYS */
	if (shellp == NULL) {
		shellp = getenv("SHELL");
		if (shellp == NULL)
			shellp = getenv("shell");
		if (shellp == NULL)
			shellp = "/bin/sh";	/* Safer.		*/
		shname = strrchr( shellp, '/' ); 
		shname = shname ? shname+1 : shellp;
	}
	ttcolor(CTEXT);
	ttnowindow();
#ifdef	ADDFUNC	/* 93.07.08  by S.Yoshida */
#ifdef	SIGTSTP	/* 93.07.08  by S.Yoshida */
	if (strcmp(shellp, "/bin/csh") == 0) {
		if (epresf != FALSE) {
			ttmove(nrow-1, 0);
			tteeol();
			epresf = FALSE;
		}				/* Csh types a "\n"	*/
		ttmove(nrow-2, 0);		/* before "Stopped".	*/
	} else {
#endif
#endif
	ttmove(nrow-1, 0);
	if (epresf != FALSE) {
		tteeol();
		epresf = FALSE;
	}
#ifdef	ADDFUNC	/* 93.07.08  by S.Yoshida */
#ifdef	SIGTSTP	/* 93.07.08  by S.Yoshida */
	}
#endif
#endif
	ttclose();
	sgarbf = TRUE;				/* Force repaint.	*/
#ifdef	ADDFUNC	/* 93.07.08  by S.Yoshida */
#ifdef	SIGTSTP	/* 93.07.08  by S.Yoshida */
# ifdef HAVE_GETSID
	if (job_control) {
# else
	if (strcmp(shellp, "/bin/sh")!=0 ||
	    getenv("BASH_VERSION") || getenv("BASH"))	{
		/* C shell, ksh	or bash	*/
# endif
	    /*	omask = sigsetmask(0);  */
		oqsig = signal(SIGQUIT, SIG_IGN);
		oisig = signal(SIGINT,  SIG_IGN);
#ifdef	SIGWINCH	/* 93.07.08  by S.Yoshida */
		owsig = signal(SIGWINCH, SIG_IGN);
#endif
		(void) kill(0, SIGTSTP);
	    /*	(void) sigsetmask(omask); */
		signal(SIGINT,  oisig);
		signal(SIGQUIT, oqsig);
#ifdef	SIGWINCH	/* 93.07.08  by S.Yoshida */
		signal(SIGWINCH, owsig);
#endif
	} else {				/* Bourne shell.	*/
#endif	/* SIGTSTP */	
#endif	/* ADDFUNC */
	oqsig = signal(SIGQUIT, SIG_IGN);
	oisig = signal(SIGINT,  SIG_IGN);
#ifdef	ADDFUNC		/* 93.07.08  by S.Yoshida */
#ifdef	SIGWINCH	/* 93.07.08  by S.Yoshida */
	owsig = signal(SIGWINCH, SIG_IGN);
#endif
#endif
	if ((pid=fork()) == 0) {
		(void) signal(SIGINT, oisig);
		(void) signal(SIGQUIT, oqsig);
#ifdef	ADDFUNC		/* 93.07.08  by S.Yoshida */
#ifdef	SIGWINCH	/* 93.07.08  by S.Yoshida */
		(void) signal(SIGWINCH, owsig);
#endif
#endif
#ifdef	EXTD_DIR
		dirend();
#endif
		execlp(shellp, shname, "-i", (char *)NULL);
		_exit(1);			/* Should do better!	*/
	}
	else if (pid > 0) {
		while ((wpid=wait(&status))>=0 && wpid!=pid)
			;
	}
	else errp = TRUE;

	signal(SIGINT,  oisig);
	signal(SIGQUIT, oqsig);
#ifdef	ADDFUNC		/* 93.07.08  by S.Yoshida */
#ifdef	SIGWINCH	/* 93.07.08  by S.Yoshida */
	signal(SIGWINCH, owsig);
#endif
#ifdef	SIGTSTP	/* 93.07.08  by S.Yoshida */
	}
#endif
#endif
	ttopen();
#ifdef SIGWINCH		/* by A.ITO  21 Jan. 1991 / by S.Yoshida */
	refresh(FFRAND, 0);		/* May be resized.	*/
#endif
	if(errp)
		ewprintf("Failed to create process");
#ifdef XKEYS  /* 92.03.16 by Gen KUROKI */
	ttykeypadstart();
#endif /* XKEYS */

	return !( errp | status );
}

#ifndef NO_SHELL	/* 91.01.10  by K.Maeda */
#include <sys/types.h>
#include <sys/stat.h>
/*
 *	Call process in subshell.
 * Execute COMMAND binding standard input to file INPUT.
 * NULL as INPUT means standard input should be bound to
 * /dev/null or whatever equivalent in your OS.
 * All output during the execution (including standard error output)
 * should go into a scratch file, whose name call_process() returns.
 * Return value NULL means error in some stage of the execution.
 * In that case, scratch file should be deleted.
 */
char *
call_process(command, input)
char *command;
char *input;
{
	char buf[256];
	char *tmp;
	static char tmpbuf[20];
	int ostdin, ostdout, ostderr, in, out, s;
	extern char *mktemp();

	strcpy(tmpbuf, "/tmp/ngXXXXXX");
	if ((tmp = mktemp(tmpbuf)) == NULL)
		return NULL;
	if ((in = open(input ? input : "/dev/null", 0)) < 0)
		return NULL;
	if ((out = creat(tmp, S_IREAD | S_IWRITE)) < 0) {
		close(in);
		return NULL;
	}
	ostdin = dup(0); ostdout = dup(1); ostderr = dup(2);
	if (ostdin < 0 || ostdout < 0 || ostderr < 0) {
		s = -1;
		goto skip;
	}
#ifndef	SVR2	/* 91.02.04  SVR3 or later. by Junn Ohta */
	dup2(in, 0);
	dup2(out, 1);
	dup2(out, 2);
#else	/* SVR2 */
	close(0); dup(in);
	close(1); dup(out);
	close(2); dup(out);
#endif	/* SVR2 */
	strcpy(buf, command);
#ifdef	EXTD_DIR
	ensurecwd();
#endif
	s = system(buf);
	close(in);
	close(out);
#ifndef	SVR2	/* 91.02.04  SVR3 or later. by Junn Ohta */
	dup2(ostdin, 0); dup2(ostdout, 1); dup2(ostderr, 2);
#else	/* SVR2 */
	close(0); dup(ostdin);
	close(1); dup(ostdout);
	close(2); dup(ostderr);
#endif	/* SVR2 */
skip:	close(ostdin); close(ostdout); close(ostderr);
	if (s == -1) {
		unlink(tmp);
		return NULL;
	}
	return tmp;
}