Quizzer

 view release on metacpan or  search on metacpan

exercises/compile-tcsh/tcsh-6.10.00/ed.h  view on Meta::CPAN

# define M_CHAR		4
# define M_NN		5
#else /* GSTTY */
# define M_CONTROL	0
# define M_LOCAL	1
# define M_CHAR		2
# define M_NN		3
#endif /* TERMIO */
typedef struct { 
    char *t_name;
    int  t_setmask;
    int  t_clrmask;
} ttyperm_t[NN_IO][M_NN];

extern ttyperm_t ttylist;
#include "ed.decls.h"

#endif /* _h_ed */

exercises/compile-tcsh/tcsh-6.10.00/ed.init.c  view on Meta::CPAN

	    ClearDisp();
	    MoveToLine(0);
	    MoveToChar(0);
	    ChangeSize(lins, cols);
	    Refresh();
	}
	else
	    ChangeSize(lins, cols);
    }
#ifdef BSDSIGS
    (void) sigsetmask(omask);	/* can change it again */
#else				/* BSDSIGS */
    (void) sigrelse(SIG_WINDOW);
#endif /* BSDSIGS */
}

sigret_t
/*ARGSUSED*/
window_change(snum)
int snum;
{

exercises/compile-tcsh/tcsh-6.10.00/ed.init.c  view on Meta::CPAN

    }

    tstty = edtty = extty;

    T_Speed = tty_getspeed(&extty);
    T_Tabs = tty_gettabs(&extty);
    Tty_eight_bit = tty_geteightbit(&extty);

# if defined(POSIX) || defined(TERMIO)
    extty.d_t.c_iflag &= ~ttylist[EX_IO][M_INPUT].t_clrmask;
    extty.d_t.c_iflag |=  ttylist[EX_IO][M_INPUT].t_setmask;

    extty.d_t.c_oflag &= ~ttylist[EX_IO][M_OUTPUT].t_clrmask;
    extty.d_t.c_oflag |=  ttylist[EX_IO][M_OUTPUT].t_setmask;

    extty.d_t.c_cflag &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
    extty.d_t.c_cflag |=  ttylist[EX_IO][M_CONTROL].t_setmask;

    extty.d_t.c_lflag &= ~ttylist[EX_IO][M_LINED].t_clrmask;
    extty.d_t.c_lflag |=  ttylist[EX_IO][M_LINED].t_setmask;

#  if defined(IRIX3_3) && SYSVREL < 4
    extty.d_t.c_line = NTTYDISC;
#  endif /* IRIX3_3 && SYSVREL < 4 */

# else	/* GSTTY */		/* V7, Berkeley style tty */

    if (T_Tabs) {	/* order of &= and |= is important to XTABS */
	extty.d_t.sg_flags &= ~(ttylist[EX_IO][M_CONTROL].t_clrmask|XTABS);
	extty.d_t.sg_flags |=   ttylist[EX_IO][M_CONTROL].t_setmask;
    }
    else {
	extty.d_t.sg_flags &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
	extty.d_t.sg_flags |= (ttylist[EX_IO][M_CONTROL].t_setmask|XTABS);
    }

    extty.d_lb &= ~ttylist[EX_IO][M_LOCAL].t_clrmask;
    extty.d_lb |=  ttylist[EX_IO][M_LOCAL].t_setmask;

# endif /* GSTTY */
    /*
     * Reset the tty chars to reasonable defaults
     * If they are disabled, then enable them.
     */
    if (rst) {
	if (tty_cooked_mode(&tstty)) {
	    tty_getchar(&tstty, ttychars[TS_IO]);
	    /*

exercises/compile-tcsh/tcsh-6.10.00/ed.init.c  view on Meta::CPAN

     * changed, so get new termcaps and try again
     */

    if (!GotTermCaps)
	GetTermCaps();		/* does the obvious, but gets term type each
				 * time */

#ifndef WINNT_NATIVE
# if defined(TERMIO) || defined(POSIX)
    edtty.d_t.c_iflag &= ~ttylist[ED_IO][M_INPUT].t_clrmask;
    edtty.d_t.c_iflag |=  ttylist[ED_IO][M_INPUT].t_setmask;

    edtty.d_t.c_oflag &= ~ttylist[ED_IO][M_OUTPUT].t_clrmask;
    edtty.d_t.c_oflag |=  ttylist[ED_IO][M_OUTPUT].t_setmask;

    edtty.d_t.c_cflag &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
    edtty.d_t.c_cflag |=  ttylist[ED_IO][M_CONTROL].t_setmask;

    edtty.d_t.c_lflag &= ~ttylist[ED_IO][M_LINED].t_clrmask;
    edtty.d_t.c_lflag |=  ttylist[ED_IO][M_LINED].t_setmask;


#  if defined(IRIX3_3) && SYSVREL < 4
    edtty.d_t.c_line = NTTYDISC;
#  endif /* IRIX3_3 && SYSVREL < 4 */

# else /* GSTTY */

    if (T_Tabs) {	/* order of &= and |= is important to XTABS */
	edtty.d_t.sg_flags &= ~(ttylist[ED_IO][M_CONTROL].t_clrmask | XTABS);
	edtty.d_t.sg_flags |=   ttylist[ED_IO][M_CONTROL].t_setmask;
    }
    else {
	edtty.d_t.sg_flags &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
	edtty.d_t.sg_flags |= (ttylist[ED_IO][M_CONTROL].t_setmask | XTABS);
    }

    edtty.d_lb &= ~ttylist[ED_IO][M_LOCAL].t_clrmask;
    edtty.d_lb |=  ttylist[ED_IO][M_LOCAL].t_setmask;
# endif /* POSIX || TERMIO */

    tty_setchar(&edtty, ttychars[ED_IO]);
#endif /* WINNT_NATIVE */
}

/* 
 * Check and re-init the line. set the terminal into 1 char at a time mode.
 */
int

exercises/compile-tcsh/tcsh-6.10.00/ed.init.c  view on Meta::CPAN

	 * "stty -tabs"
	 */
	if (tty_gettabs(&tstty) == 0)
	    T_Tabs = 0;
	else 
	    T_Tabs = CanWeTab();

# if defined(POSIX) || defined(TERMIO)
	extty.d_t.c_cflag  = tstty.d_t.c_cflag;
	extty.d_t.c_cflag &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
	extty.d_t.c_cflag |=  ttylist[EX_IO][M_CONTROL].t_setmask;

	edtty.d_t.c_cflag  = tstty.d_t.c_cflag;
	edtty.d_t.c_cflag &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
	edtty.d_t.c_cflag |=  ttylist[ED_IO][M_CONTROL].t_setmask;

	extty.d_t.c_lflag = tstty.d_t.c_lflag;
	extty.d_t.c_lflag &= ~ttylist[EX_IO][M_LINED].t_clrmask;
	extty.d_t.c_lflag |=  ttylist[EX_IO][M_LINED].t_setmask;

	edtty.d_t.c_lflag = tstty.d_t.c_lflag;
	edtty.d_t.c_lflag &= ~ttylist[ED_IO][M_LINED].t_clrmask;
	edtty.d_t.c_lflag |=  ttylist[ED_IO][M_LINED].t_setmask;

	extty.d_t.c_iflag = tstty.d_t.c_iflag;
	extty.d_t.c_iflag &= ~ttylist[EX_IO][M_INPUT].t_clrmask;
	extty.d_t.c_iflag |=  ttylist[EX_IO][M_INPUT].t_setmask;

	edtty.d_t.c_iflag = tstty.d_t.c_iflag;
	edtty.d_t.c_iflag &= ~ttylist[ED_IO][M_INPUT].t_clrmask;
	edtty.d_t.c_iflag |=  ttylist[ED_IO][M_INPUT].t_setmask;

	extty.d_t.c_oflag = tstty.d_t.c_oflag;
	extty.d_t.c_oflag &= ~ttylist[EX_IO][M_OUTPUT].t_clrmask;
	extty.d_t.c_oflag |=  ttylist[EX_IO][M_OUTPUT].t_setmask;

	edtty.d_t.c_oflag = tstty.d_t.c_oflag;
	edtty.d_t.c_oflag &= ~ttylist[ED_IO][M_OUTPUT].t_clrmask;
	edtty.d_t.c_oflag |=  ttylist[ED_IO][M_OUTPUT].t_setmask;

# else /* GSTTY */

	extty.d_t.sg_flags = tstty.d_t.sg_flags;

	extty.d_t.sg_flags &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
	extty.d_t.sg_flags |=  ttylist[EX_IO][M_CONTROL].t_setmask;

	if (T_Tabs)		/* order of &= and |= is important to XTABS */
	    extty.d_t.sg_flags &= ~XTABS;
	else 
	    extty.d_t.sg_flags |= XTABS;

	extty.d_lb = tstty.d_lb;
	extty.d_lb &= ~ttylist[EX_IO][M_LOCAL].t_clrmask;
	extty.d_lb |= ttylist[EX_IO][M_LOCAL].t_setmask;

	edtty.d_t.sg_flags = extty.d_t.sg_flags;
	if (T_Tabs) {	/* order of &= and |= is important to XTABS */
	    edtty.d_t.sg_flags &= 
		    ~(ttylist[ED_IO][M_CONTROL].t_clrmask|XTABS);
	    edtty.d_t.sg_flags |=   ttylist[ED_IO][M_CONTROL].t_setmask;
	}
	else {
	    edtty.d_t.sg_flags &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
	    edtty.d_t.sg_flags |= 
		    (ttylist[ED_IO][M_CONTROL].t_setmask|XTABS);
	}

	edtty.d_lb = tstty.d_lb;
	edtty.d_lb &= ~ttylist[ED_IO][M_LOCAL].t_clrmask;
	edtty.d_lb |= ttylist[ED_IO][M_LOCAL].t_setmask;

# endif /* TERMIO || POSIX */

	{
	    extern int didsetty;
	    int i;

	    tty_getchar(&tstty, ttychars[TS_IO]);
	    /*
	     * Check if the user made any changes.

exercises/compile-tcsh/tcsh-6.10.00/ed.init.c  view on Meta::CPAN

		if (ttychars[TS_IO][i] != ttychars[EX_IO][i])
		    break;
		
	    if (i != C_NCC || didsetty) {
		didsetty = 0;
		/*
		 * Propagate changes only to the unprotected chars
		 * that have been modified just now.
		 */
		for (i = 0; i < C_NCC; i++) {
		    if (!((ttylist[ED_IO][M_CHAR].t_setmask & C_SH(i))) &&
			(ttychars[TS_IO][i] != ttychars[EX_IO][i]))
			ttychars[ED_IO][i] = ttychars[TS_IO][i];
		    if (ttylist[ED_IO][M_CHAR].t_clrmask & C_SH(i))
			ttychars[ED_IO][i] = vdisable;
		}
		tty_setchar(&edtty, ttychars[ED_IO]);

		for (i = 0; i < C_NCC; i++) {
		    if (!((ttylist[EX_IO][M_CHAR].t_setmask & C_SH(i))) &&
			(ttychars[TS_IO][i] != ttychars[EX_IO][i]))
			ttychars[EX_IO][i] = ttychars[TS_IO][i];
		    if (ttylist[EX_IO][M_CHAR].t_clrmask & C_SH(i))
			ttychars[EX_IO][i] = vdisable;
		}
		tty_setchar(&extty, ttychars[EX_IO]);
	    }

	}
    }

exercises/compile-tcsh/tcsh-6.10.00/ed.init.c  view on Meta::CPAN

QuoteModeOn()
{
    if (MacroLvl >= 0)
	return;

#ifndef WINNT_NATIVE
    qutty = edtty;

#if defined(TERMIO) || defined(POSIX)
    qutty.d_t.c_iflag &= ~ttylist[QU_IO][M_INPUT].t_clrmask;
    qutty.d_t.c_iflag |=  ttylist[QU_IO][M_INPUT].t_setmask;

    qutty.d_t.c_oflag &= ~ttylist[QU_IO][M_OUTPUT].t_clrmask;
    qutty.d_t.c_oflag |=  ttylist[QU_IO][M_OUTPUT].t_setmask;

    qutty.d_t.c_cflag &= ~ttylist[QU_IO][M_CONTROL].t_clrmask;
    qutty.d_t.c_cflag |=  ttylist[QU_IO][M_CONTROL].t_setmask;

    qutty.d_t.c_lflag &= ~ttylist[QU_IO][M_LINED].t_clrmask;
    qutty.d_t.c_lflag |=  ttylist[QU_IO][M_LINED].t_setmask;
#else /* GSTTY */
    qutty.d_t.sg_flags &= ~ttylist[QU_IO][M_CONTROL].t_clrmask;
    qutty.d_t.sg_flags |= ttylist[QU_IO][M_CONTROL].t_setmask;
    qutty.d_lb &= ~ttylist[QU_IO][M_LOCAL].t_clrmask;
    qutty.d_lb |= ttylist[QU_IO][M_LOCAL].t_setmask;

#endif /* TERMIO || POSIX */
    if (tty_setty(SHTTY, &qutty) == -1) {
#ifdef DEBUG_TTY
	xprintf("QuoteModeOn: tty_setty: %s\n", strerror(errno));
#endif /* DEBUG_TTY */
	return;
    }
#endif /* !WINNT_NATIVE */
    Tty_quote_mode = 1;

exercises/compile-tcsh/tcsh-6.10.00/ed.screen.c  view on Meta::CPAN

	xprintf(CGETS(7, 27, "no insert char capability.\n"));
#endif /* DEBUG_SCREEN */



#ifdef SIG_WINDOW
    (void) GetSize(&lins, &cols);	/* get the correct window size */
    ChangeSize(lins, cols);

# ifdef BSDSIGS
    (void) sigsetmask(omask);	/* can change it again */
# else /* BSDSIGS */
    (void) sigrelse(SIG_WINDOW);
# endif /* BSDSIGS */
#else /* SIG_WINDOW */
    ChangeSize(Val(T_li), Val(T_co));
#endif /* SIG_WINDOW */

    BindArrowKeys();
}

exercises/compile-tcsh/tcsh-6.10.00/ed.term.c  view on Meta::CPAN

	int i = -1;
	int len = 0, st = 0, cu;
	for (m = modelist; m->m_name; m++) {
	    if (m->m_type != i) {
		xprintf("%s%s", i != -1 ? "\n" : "", 
			ttylist[z][m->m_type].t_name);
		i = m->m_type;
		st = len = strlen(ttylist[z][m->m_type].t_name);
	    }

	    x = (ttylist[z][i].t_setmask & m->m_value) ? '+' : '\0';
	    x = (ttylist[z][i].t_clrmask & m->m_value) ? '-' : x;

	    if (x != '\0' || aflag) {
		cu = strlen(m->m_name) + (x != '\0') + 1;
		if (len + cu >= T_Cols) {
		    xprintf("\n%*s", st, "");
		    len = st + cu;
		}
		else 
		    len += cu;

exercises/compile-tcsh/tcsh-6.10.00/ed.term.c  view on Meta::CPAN

	}
	d = short2str(s);
	for (m = modelist; m->m_name; m++)
	    if (strcmp(m->m_name, d) == 0)
		break;
	if (!m->m_name) 
	    stderror(ERR_NAME | ERR_SYSTEM, d, CGETS(8, 2, "Invalid argument"));

	switch (x) {
	case '+':
	    ttylist[z][m->m_type].t_setmask |= m->m_value;
	    ttylist[z][m->m_type].t_clrmask &= ~m->m_value;
	    break;
	case '-':
	    ttylist[z][m->m_type].t_setmask &= ~m->m_value;
	    ttylist[z][m->m_type].t_clrmask |= m->m_value;
	    break;
	default:
	    ttylist[z][m->m_type].t_setmask &= ~m->m_value;
	    ttylist[z][m->m_type].t_clrmask &= ~m->m_value;
	    break;
	}
    }
} /* end dosetty */

int
tty_getty(fd, td)
   int fd;
   ttydata_t *td;

exercises/compile-tcsh/tcsh-6.10.00/sh.c  view on Meta::CPAN

#endif
	    if (!arginp && !onelflg && !havhash)
		dohash(NULL,NULL);
#ifndef LOGINFIRST
#ifdef _PATH_DOTLOGIN
	    if (loginsh)
		(void) srcfile(_PATH_DOTLOGIN, 0, 0, NULL);
#endif
#endif
#ifdef BSDSIGS
	    (void) sigsetmask(omask);
#else
	    (void) sigrelse(SIGINT);
#endif
	    setintr = osetintr;
	    parintr = oparintr;
	}
#ifdef LOGINFIRST
	if (loginsh)
	    (void) srccat(varval(STRhome), STRsldotlogin);
#endif

exercises/compile-tcsh/tcsh-6.10.00/sh.c  view on Meta::CPAN


    /* Save the current state and move us to a new state */
    st_save(&st, unit, hflg, NULL, av);

    /*
     * Now if we are allowing commands to be interrupted, we let ourselves be
     * interrupted.
     */
    if (setintr)
#ifdef BSDSIGS
	(void) sigsetmask(st.mask);
#else
	(void) sigrelse(SIGINT);
#endif

    /*
     * Bugfix for running out of memory by: Jak Kirman
     * <jak%cs.brown.edu@RELAY.CS.NET>.  Solution: pay attention to what
     * setexit() is returning because reenter _may_ be in a register, and
     * thus restored to 0 on a longjump(). (PWP: insert flames about
     * compiler-dependant code here) PWP: THANKS LOTS !!!

exercises/compile-tcsh/tcsh-6.10.00/sh.c  view on Meta::CPAN

    if (setexit() == 0) {
	st.reenter = 0;		/* Oh well, we were wrong */
#else
    if ((st.reenter = setexit()) == 0) {
#endif
	process(0);		/* 0 -> blow away on errors */
    }

    if (setintr)
#ifdef BSDSIGS
	(void) sigsetmask(st.mask);
#else
	(void) sigrelse(SIGINT);
#endif

    /* Restore the old state */
    st_restore(&st, av);
    resexit(st.oldexit);
    /*
     * If process reset() (effectively an unwind) then we must also unwind.
     */

exercises/compile-tcsh/tcsh-6.10.00/sh.c  view on Meta::CPAN

    register Char **v;
#ifdef BSDSIGS
    sigmask_t omask;
#endif

#ifdef BSDSIGS
    omask = sigblock((sigmask_t) 0);
#endif
    if (setintr) {
#ifdef BSDSIGS
	(void) sigsetmask(omask & ~sigmask(SIGINT));
#else
	(void) sigrelse(SIGINT);
#endif
	if (pjobs) {
	    pjobs = 0;
	    xputchar('\n');
	    dojobs(jobargv, NULL);
	    stderror(ERR_NAME | ERR_INTR);
	}
    }

exercises/compile-tcsh/tcsh-6.10.00/sh.c  view on Meta::CPAN

	    stderror(ERR_SILENT);
    }
    /* JV - Make sure we shut off inputl */
    {
	extern Char GettingInput;

	(void) Cookedmode();
	GettingInput = 0;
    }
#ifdef BSDSIGS
    (void) sigsetmask(omask & ~sigmask(SIGCHLD));
#else
    if (setintr)
	(void) sighold(SIGINT);
    (void) sigrelse(SIGCHLD);
#endif
    drainoline();
#if !defined(_VMS_POSIX) && !defined(WINNT_NATIVE)
    (void) endpwent();
#endif /* !_VMS_POSIX && !WINNT_NATIVE */

exercises/compile-tcsh/tcsh-6.10.00/sh.c  view on Meta::CPAN

	paraml.next = paraml.prev = &paraml;
	paraml.word = STRNULL;
	(void) setexit();
	justpr = enterhist;	/* execute if not entering history */

	/*
	 * Interruptible during interactive reads
	 */
	if (setintr)
#ifdef BSDSIGS
	    (void) sigsetmask(sigblock((sigmask_t) 0) & ~sigmask(SIGINT));
#else
	    (void) sigrelse(SIGINT);
#endif


	/*
	 * For the sake of reset()
	 */
	freelex(&paraml);
	if (savet)

exercises/compile-tcsh/tcsh-6.10.00/sh.dol.c  view on Meta::CPAN

    case '<'|QUOTE:
#endif
	if (bitset)
	    stderror(ERR_NOTALLOWED, "$?<");
	if (dimen)
	    stderror(ERR_NOTALLOWED, "$#<");
	if (length)
	    stderror(ERR_NOTALLOWED, "$%<");
	{
#ifdef BSDSIGS
	    sigmask_t omask = sigsetmask(sigblock(0) & ~sigmask(SIGINT));
#else /* !BSDSIGS */
	    (void) sigrelse(SIGINT);
#endif /* BSDSIGS */
	    for (np = wbuf; force_read(OLDSTD, &tnp, 1) == 1; np++) {
		*np = (unsigned char) tnp;
		if (np >= &wbuf[BUFSIZE - 1])
		    stderror(ERR_LTOOLONG);
		if (tnp == '\n')
		    break;
	    }
	    *np = 0;
#ifdef BSDSIGS
	    (void) sigsetmask(omask);
#else /* !BSDSIGS */
	    (void) sighold(SIGINT);
#endif /* BSDSIGS */
	}

#ifdef COMPAT
	/*
	 * KLUDGE: dolmod is set here because it will cause setDolp to call
	 * domod and thus to copy wbuf. Otherwise setDolp would use it
	 * directly. If we saved it ourselves, no one would know when to free

exercises/compile-tcsh/tcsh-6.10.00/sh.exec.c  view on Meta::CPAN

    isoutatty = isatty(SHOUT);
    isdiagatty = isatty(SHDIAG);
#else
    closech();			/* Close random fd's */
#endif
    /*
     * We must do this AFTER any possible forking (like `foo` in glob) so that
     * this shell can still do subprocesses.
     */
#ifdef BSDSIGS
    (void) sigsetmask((sigmask_t) 0);
#else /* BSDSIGS */
    (void) sigrelse(SIGINT);
    (void) sigrelse(SIGCHLD);
#endif /* BSDSIGS */

    /*
     * If no path, no words in path, or a / in the filename then restrict the
     * command search.
     */
    if (v == 0 || v->vec[0] == 0 || slash)

exercises/compile-tcsh/tcsh-6.10.00/sh.file.c  view on Meta::CPAN

#else
    (void) ioctl(SHIN, TIOCGETP, (ioctl_t) & tty);
    tty_normal = tty;
    tty.sg_flags &= ~CRMOD;
    (void) ioctl(SHIN, TIOCSETN, (ioctl_t) & tty);
    (void) write(SHOUT, "\r", 1);
    (void) ioctl(SHIN, TIOCSETN, (ioctl_t) & tty_normal);
#endif /* TERMIO */

# ifdef BSDSIGS
    (void) sigsetmask(omask);
# else
    (void) sigrelse(SIGINT);
# endif /* BSDISGS */
}

/*
 * Push string contents back into tty queue
 */
static void
pushback(string)

exercises/compile-tcsh/tcsh-6.10.00/sh.file.c  view on Meta::CPAN

    (void) ioctl(SHOUT, TCSETAW, (ioctl_t) &tty);
# endif /* POSIX */

    for (p = string; c = *p; p++)
	(void) ioctl(SHOUT, TIOCSTI, (ioctl_t) & c);
# ifdef POSIX
    (void) tcsetattr(SHOUT, TCSANOW, &tty_normal);
# else
    (void) ioctl(SHOUT, TCSETAW, (ioctl_t) &tty_normal);
# endif /* POSIX */
    (void) sigsetmask(omask);
#else
    (void) ioctl(SHOUT, TIOCGETP, (ioctl_t) & tty);
    tty_normal = tty;
    tty.sg_flags &= ~ECHO;
    (void) ioctl(SHOUT, TIOCSETN, (ioctl_t) & tty);

    for (p = string; c = *p; p++)
	(void) ioctl(SHOUT, TIOCSTI, (ioctl_t) & c);
    (void) ioctl(SHOUT, TIOCSETN, (ioctl_t) & tty_normal);
#endif /* TERMIO */

# ifdef BSDSIGS
    (void) sigsetmask(omask);
# else
    (void) sigrelse(SIGINT);
# endif /* BSDISGS */
}

/*
 * Concatenate src onto tail of des.
 * Des is a string whose maximum length is count.
 * Always null terminate.
 */

exercises/compile-tcsh/tcsh-6.10.00/sh.file.c  view on Meta::CPAN

    xfree((ptr_t) items);
}

#ifdef BSDSIGS
# define FREE_ITEMS(items) { \
	sigmask_t omask;\
\
	omask = sigblock(sigmask(SIGINT));\
	free_items(items);\
	items = NULL;\
	(void) sigsetmask(omask);\
}
#else
# define FREE_ITEMS(items) { \
	(void) sighold(SIGINT);\
	free_items(items);\
	items = NULL;\
	(void) sigrelse(SIGINT);\
}
#endif /* BSDSIGS */

exercises/compile-tcsh/tcsh-6.10.00/sh.func.c  view on Meta::CPAN

	/* We ain't gonna loop no more, no more! */
	toend();
}

static void
preread()
{
    whyles->w_end.type = TCSH_I_SEEK;
    if (setintr)
#ifdef BSDSIGS
	(void) sigsetmask(sigblock((sigmask_t) 0) & ~sigmask(SIGINT));
#else /* !BSDSIGS */
	(void) sigrelse (SIGINT);
#endif /* BSDSIGS */
    search(TC_BREAK, 0, NULL);		/* read the expression in */
    if (setintr)
#ifdef BSDSIGS
	(void) sigblock(sigmask(SIGINT));
#else /* !BSDSIGS */
	(void) sighold(SIGINT);
#endif /* BSDSIGS */

exercises/compile-tcsh/tcsh-6.10.00/sh.func.c  view on Meta::CPAN

    if (setintr)
#ifdef BSDSIGS
	omask = sigblock(sigmask(SIGINT)) & ~sigmask(SIGINT);
#else /* !BSDSIGS */
	(void) sighold(SIGINT);
#endif /* BSDSIGS */
    lshift(v, 2);
    while (i > 0) {
	if (setintr)
#ifdef BSDSIGS
	    (void) sigsetmask(omask);
#else /* !BSDSIGS */
	    (void) sigrelse (SIGINT);
#endif /* BSDSIGS */
	reexecute(kp);
	--i;
    }
    donefds();
    if (setintr)
#ifdef BSDSIGS
	(void) sigsetmask(omask);
#else /* !BSDSIGS */
	(void) sigrelse (SIGINT);
#endif /* BSDSIGS */
}

/*ARGSUSED*/
void
doswbrk(v, c)
    Char **v;
    struct command *c;

exercises/compile-tcsh/tcsh-6.10.00/sh.func.c  view on Meta::CPAN

	else if (Strcmp(vp->vec[0], STRsysv) == 0)
	    echo_style = SYSV_ECHO;
	else if (Strcmp(vp->vec[0], STRboth) == 0)
	    echo_style = BOTH_ECHO;
	else if (Strcmp(vp->vec[0], STRnone) == 0)
	    echo_style = NONE_ECHO;
    }

    if (setintr)
#ifdef BSDSIGS
	(void) sigsetmask(sigblock((sigmask_t) 0) & ~sigmask(SIGINT));
#else /* !BSDSIGS */
	(void) sigrelse (SIGINT);
#endif /* BSDSIGS */
    v++;
    if (*v == 0)
	return;
    gflag = 0, tglob(v);
    if (gflag) {
	v = globall(v);
	if (v == 0)

exercises/compile-tcsh/tcsh-6.10.00/sh.func.c  view on Meta::CPAN

    register Char **v;
    struct command *c;
{
    Char   *e;
    extern bool output_raw;
    extern bool xlate_cr;

    USE(c);
    if (setintr)
#ifdef BSDSIGS
	(void) sigsetmask(sigblock((sigmask_t) 0) & ~sigmask(SIGINT));
#else /* !BSDSIGS */
	(void) sigrelse (SIGINT);
#endif /* BSDSIGS */

    v++;
    if (*v == 0) {
	register Char **ep;

	xlate_cr = 1;
	for (ep = STR_environ; *ep; ep++)

exercises/compile-tcsh/tcsh-6.10.00/sh.hist.c  view on Meta::CPAN

    Char  **vp;
    struct command *c;
{
    int     n, hflg = 0;

    USE(c);
    if (getn(varval(STRhistory)) == 0)
	return;
    if (setintr)
#ifdef BSDSIGS
	(void) sigsetmask(sigblock((sigmask_t) 0) & ~sigmask(SIGINT));
#else
	(void) sigrelse(SIGINT);
#endif
    while (*++vp && **vp == '-') {
	Char   *vp2 = *vp;

	while (*++vp2)
	    switch (*vp2) {
	    case 'c':
		hflg |= HIST_CLEAR;

exercises/compile-tcsh/tcsh-6.10.00/sh.proc.c  view on Meta::CPAN

#ifdef BSDSIGS
	    omask = sigblock(sigmask(SIGCHLD));
#else /* !BSDSIGS */
	    (void) sighold(SIGCHLD);
#endif /* !BSDSIGS */
	    pp->p_flags &= ~PNEEDNOTE;
	    flags = pprint(pp, NUMBER | NAME | REASON);
	    if ((flags & (PRUNNING | PSTOPPED)) == 0)
		pflush(pp);
#ifdef BSDSIGS
	    (void) sigsetmask(omask);
#else /* !BSDSIGS */
	    (void) sigrelse(SIGCHLD);
#endif /* !BSDSIGS */
	}
    }
}


static void
pfree(pp)

exercises/compile-tcsh/tcsh-6.10.00/sh.proc.c  view on Meta::CPAN

#else /* !BSDSIGS */
    (void) sighold(SIGCHLD);
#endif /* !BSDSIGS */
    for (pp = (fp = &proclist)->p_next; pp != NULL; pp = (fp = pp)->p_next)
	if (pp->p_procid == 0) {
	    fp->p_next = pp->p_next;
	    pfree(pp);
	    pp = fp;
	}
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else /* !BSDSIGS */
    (void) sigrelse(SIGCHLD);
# ifdef notdef
    if (setintr)
	sigignore(SIGINT);
# endif /* notdef */
#endif /* !BSDSIGS */
    pjwait(pcurrjob);
}

exercises/compile-tcsh/tcsh-6.10.00/sh.proc.c  view on Meta::CPAN

	/* (void) sigpause(sigblock((sigmask_t) 0) &~ sigmask(SIGCHLD)); */
	(void) sigpause(omask & ~sigmask(SIGCHLD));
#else /* !BSDSIGS */
	(void) sigpause(SIGCHLD);
#endif /* !BSDSIGS */
    }
#ifdef JOBDEBUG
	xprintf("%d returned from sigpause loop\n", getpid());
#endif /* JOBDEBUG */
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else /* !BSDSIGS */
    (void) sigrelse(SIGCHLD);
#endif /* !BSDSIGS */
#ifdef UNRELSIGS
    if (setintr)
        (void) signal(SIGINT, inthandler);
#endif /* UNRELSIGS */
#ifdef BSDJOBS
    if (tpgrp > 0)		/* get tty back */
	(void) tcsetpgrp(FSHTTY, tpgrp);

exercises/compile-tcsh/tcsh-6.10.00/sh.proc.c  view on Meta::CPAN

	if (pp->p_procid &&	/* pp->p_procid == pp->p_jobid && */
	    pp->p_flags & PRUNNING) {
#ifdef BSDSIGS
	    (void) sigpause((sigmask_t) 0);
#else /* !BSDSIGS */
	    (void) sigpause(SIGCHLD);
#endif /* !BSDSIGS */
	    goto loop;
	}
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else /* !BSDSIGS */
    (void) sigrelse(SIGCHLD);
#endif /* !BSDSIGS */
    pjobs = 0;
}

/*
 * pflushall - flush all jobs from list (e.g. at fork())
 */
static void

exercises/compile-tcsh/tcsh-6.10.00/sh.proc.c  view on Meta::CPAN

	    if (signum == SIGTERM || signum == SIGHUP)
		(void) kill(pid, SIGCONT);
#endif /* BSDJOBS */
	}
cont:
	v++;
    }
    if (gargv)
	blkfree(gargv), gargv = 0;
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else /* !BSDSIGS */
    (void) sigrelse(SIGCHLD);
    if (setintr)
	(void) sigrelse(SIGINT);
#endif /* !BSDSIGS */
    if (err1)
	stderror(ERR_SILENT);
}

/*

exercises/compile-tcsh/tcsh-6.10.00/sh.proc.c  view on Meta::CPAN

     *    a debugger it does not confuse the shell. [christos]
     * 8. on the nec sx-4 there seems to be a problem, which requires
     *    a syscall(151, getpid(), getpid()) in osinit. Don't ask me
     *    what this is doing. [schott@rzg.mpg.de]
     */

    if (rv != -1)
	rv = killpg(pp->p_jobid, SIGCONT);
#endif /* BSDJOBS */
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else /* !BSDSIGS */
    (void) sigrelse(SIGCHLD);
#endif /* !BSDSIGS */
    return rv != -1;
}

void
panystop(neednl)
    bool    neednl;
{

exercises/compile-tcsh/tcsh-6.10.00/sh.proc.c  view on Meta::CPAN

#else /* !BSDSIGS */
	(void) sighold(SIGCHLD);
#endif /* !BSDSIGS */
    }
    while ((pid = fork()) == -1)
	if (setintr == 0)
	    (void) sleep(FORKSLEEP);
	else {
	    if (wanttty < 0)
#ifdef BSDSIGS
		(void) sigsetmask(omask);
#else /* !BSDSIGS */
		(void) sigrelse(SIGCHLD);
	    (void) sigrelse(SIGINT);
#endif /* !BSDSIGS */
	    stderror(ERR_NOPROC);
	}
    if (pid == 0) {
	settimes();
	pgrp = pcurrjob ? pcurrjob->p_jobid : getpid();
	pflushall();

exercises/compile-tcsh/tcsh-6.10.00/sh.proc.c  view on Meta::CPAN

	 * one.
	 */
	(void) sigpause(omask & ~SYNCHMASK);
	if (mysigvec(SIGSYNCH, &osv, NULL))
	    stderror(ERR_SYSTEM, "pfork parent: sigvec restore",
		     strerror(errno));
#endif /* SIGSYNCH */

	if (wanttty < 0) {
#ifdef BSDSIGS
	    (void) sigsetmask(omask);
#else /* !BSDSIGS */
	    (void) sigrelse(SIGCHLD);
#endif /* !BSDSIGS */
	}
    }
    return (pid);
}

static void
okpcntl()

exercises/compile-tcsh/tcsh-6.10.00/sh.proc.c  view on Meta::CPAN

			      * the process group leader
			      */
# endif /* POSIXJOBS */
	}
    }

# ifdef POSIXJOBS
    if (wanttty > 0)
	setttypgrp(pgrp);
#  ifdef BSDSIGS
    (void) sigsetmask(omask);
#  else /* BSDSIGS */
    (void) sigrelse(SIGTSTP);
    (void) sigrelse(SIGTTIN);
#  endif /* !BSDSIGS */
# endif /* POSIXJOBS */

# ifdef JOBDEBUG
    xprintf("wanttty %d pid %d pgrp %d tpgrp %d\n", 
	    wanttty, getpid(), mygetpgrp(), tcgetpgrp(FSHTTY));
# endif /* JOBDEBUG */

exercises/compile-tcsh/tcsh-6.10.00/sh.sem.c  view on Meta::CPAN

#else /* !BSDSIGS */
		    (void) sighold(SIGCHLD);
#endif /* BSDSIGS */

		    nosigchld = 1;
		}

		pid = pfork(t, wanttty);
		if (pid == 0 && nosigchld) {
#ifdef BSDSIGS
		    (void) sigsetmask(csigmask);
#else /* !BSDSIGS */
		    (void) sigrelse(SIGCHLD);
#endif /* BSDSIGS */
		    nosigchld = 0;
		}
		else if (pid != 0 && (t->t_dflg & F_AMPERSAND))
		    backpid = pid;
	    }

#ifdef VFORK

exercises/compile-tcsh/tcsh-6.10.00/sh.sem.c  view on Meta::CPAN

		if (use_fork)
		    pid = fork();
		else
		    pid = vfork();

		if (pid < 0) {
# ifdef BSDSIGS
#  ifdef SAVESIGVEC
		    restoresigvec(savesv, savesm);
#  endif /* SAVESIGVEC */
		    (void) sigsetmask(omask);
# else /* !BSDSIGS */
		    (void) sigrelse(SIGCHLD);
		    (void) sigrelse(SIGINT);
# endif  /* BSDSIGS */
		    stderror(ERR_NOPROC);
		}
		forked++;
		if (pid) {	/* parent */
# ifdef SAVESIGVEC
		    restoresigvec(savesv, savesm);

exercises/compile-tcsh/tcsh-6.10.00/sh.sem.c  view on Meta::CPAN

		    Vsav = 0;
		    xfree((ptr_t) Vdp);
		    Vdp = 0;
		    xfree((ptr_t) Vexpath);
		    Vexpath = 0;
		    blkfree((Char **) Vt);
		    Vt = 0;
		    /* this is from pfork() */
		    palloc(pid, t);
# ifdef BSDSIGS
		    (void) sigsetmask(omask);
# else /* !BSDSIGS */
		    (void) sigrelse(SIGCHLD);
		    (void) sigrelse(SIGINT);
# endif  /* BSDSIGS */
		}
		else {		/* child */
		    /* this is from pfork() */
		    int     pgrp;
		    bool    ignint = 0;
		    if (nosigchld) {
# ifdef BSDSIGS
			(void) sigsetmask(csigmask);
# else /* !BSDSIGS */
			(void) sigrelse(SIGCHLD);
# endif /* BSDSIGS */
			nosigchld = 0;
		    }

		    if (setintr)
			ignint = (tpgrp == -1 && (t->t_dflg & F_NOINTERRUPT))
				|| (gointr && eq(gointr, STRminus));
		    pgrp = pcurrjob ? pcurrjob->p_jobid : getpid();

exercises/compile-tcsh/tcsh-6.10.00/sh.sem.c  view on Meta::CPAN

	    if (didfds == 0 && t->t_dflg & F_PIPEIN) {
		(void) close(pipein[0]);
		(void) close(pipein[1]);
	    }
	    if ((t->t_dflg & F_PIPEOUT) != 0)
		break;
#endif /* BACKPIPE */

	    if (nosigchld) {
#ifdef BSDSIGS
		(void) sigsetmask(csigmask);
#else /* !BSDSIGS */
		(void) sigrelse(SIGCHLD);
#endif /* BSDSIGS */
		nosigchld = 0;
	    }
	    if ((t->t_dflg & F_AMPERSAND) == 0)
		pwait();
	    break;
	}

exercises/compile-tcsh/tcsh-6.10.00/sh.set.c  view on Meta::CPAN

void
plist(p, what)
    register struct varent *p;
    int what;
{
    register struct varent *c;
    register int len;

    if (setintr)
#ifdef BSDSIGS
	(void) sigsetmask(sigblock((sigmask_t) 0) & ~sigmask(SIGINT));
#else /* !BSDSIGS */
	(void) sigrelse(SIGINT);
#endif /* BSDSIGS */

    for (;;) {
	while (p->v_left)
	    p = p->v_left;
x:
	if (p->v_parent == 0)	/* is it the header? */
	    return;

exercises/compile-tcsh/tcsh-6.10.00/sh.types.h  view on Meta::CPAN

# endif /* _SIGMASK_T */
  
# ifndef _SPEED_T
   /* I thought POSIX was supposed to protect all typedefs! */
#  define _SPEED_T
# endif /* _SPEED_T */

extern uid_t getuid(), geteuid();
extern gid_t getgid(), getegid();
extern sigmask_t sigblock();
extern sigmask_t sigsetmask();
extern pid_t getpid();
extern pid_t fork();
extern void perror();
extern void _exit();
extern void abort();
extern void qsort();
extern void free();
extern unsigned int alarm();
extern unsigned int sleep();
# if HPUXVERSION < 800	/* XXX: Not true for 8.0 */

exercises/compile-tcsh/tcsh-6.10.00/tc.decls.h  view on Meta::CPAN

# ifdef SXA
extern	void 		  sigpause	__P((int));
# endif /* SXA */
#endif /* !BSDSIGS */

#ifdef NEEDsignal
extern	sigret_t	(*xsignal	__P((int, sigret_t (*)(int)))) ();
# define signal(a, b)	  xsignal(a, b)
#endif /* NEEDsignal */
#if defined(_SEQUENT_) || ((SYSVREL > 3 || defined(_DGUX_SOURCE)) && defined(POSIXSIGS)) || ((defined(_AIX) || defined(__CYGWIN__)) && defined(POSIXSIGS)) || defined(WINNT_NATIVE)
extern	sigmask_t	  sigsetmask	__P((sigmask_t));
# if !defined(DGUX) || (defined(DGUX) && defined(__ix86))
extern	sigmask_t	  sigblock	__P((sigmask_t));
# endif /* !DGUX */
extern	void		  bsd_sigpause	__P((sigmask_t));
extern  sigret_t        (*bsd_signal    __P((int, sigret_t (*)(int)))) __P((int));
#endif /* _SEQUENT_ */
#ifdef SIGSYNCH
extern	sigret_t	  synch_handler	__P((int));
#endif /* SIGSYNCH */

exercises/compile-tcsh/tcsh-6.10.00/tc.func.c  view on Meta::CPAN

	if (seterr)
	    stderror(ERR_OLD);
	/* expand aliases like process() does */
	/* alias(&cmd); */
	/* execute the parse tree. */
	execute(t, tpgrp > 0 ? tpgrp : -1, NULL, NULL);
	/* done. free the lex list and parse tree. */
	freelex(&cmd), freesyn(t);
	if (setintr)
#ifdef BSDSIGS
	    (void) sigsetmask(omask);
#else /* !BSDSIGS */
	    (void) sigrelse(SIGINT);
#endif /* BSDSIGS */
    }
    else {
	Char   *dp, *tmp, buf[MAXPATHLEN];

	for (k = 0, i = 0; v[k] != NULL; k++) {
	    tmp = dnormalize(v[k], symlinks == SYM_IGNORE);
	    dp = &tmp[Strlen(tmp) - 1];

exercises/compile-tcsh/tcsh-6.10.00/tc.func.c  view on Meta::CPAN

	    stderror(ERR_BADJOB, pp->p_command, strerror(errno));
	}
	pjwait(pp);
    }
    setalarm(1);		/* Autologout back on */
    resexit(osetexit);
    haderr = ohaderr;
    GettingInput = oGettingInput;

#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else /* !BSDSIGS */
    (void) sigrelse(SIGINT);
#endif /* BSDSIGS */

}

static char *
xgetpass(prm)
    char *prm;
{

exercises/compile-tcsh/tcsh-6.10.00/tc.func.c  view on Meta::CPAN

#endif /* !XCRYPT */

    if (srpp == NULL) {
	auto_logout(0);
	/*NOTREACHED*/
	return;
    }

    setalarm(0);		/* Not for locking any more */
#ifdef BSDSIGS
    (void) sigsetmask(sigblock(0) & ~(sigmask(SIGALRM)));
#else /* !BSDSIGS */
    (void) sigrelse(SIGALRM);
#endif /* BSDSIGS */
    xputchar('\n'); 
    for (i = 0; i < 5; i++) {
	const char *crpp;
	char *pp;
#ifdef AFS
	char *afsname;
	Char *safs;

exercises/compile-tcsh/tcsh-6.10.00/tc.func.c  view on Meta::CPAN

	aliasrun(2, STRunalias, STRprecmd);
	xprintf(CGETS(22, 3, "Faulty alias 'precmd' removed.\n"));
	goto leave;
    }
    precmd_active = 1;
    if (!whyles && adrof1(STRprecmd, &aliases))
	aliasrun(1, STRprecmd, NULL);
leave:
    precmd_active = 0;
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else /* !BSDSIGS */
    (void) sigrelse(SIGINT);
#endif /* BSDSIGS */
}

void
postcmd()
{
#ifdef BSDSIGS
    sigmask_t omask;

exercises/compile-tcsh/tcsh-6.10.00/tc.func.c  view on Meta::CPAN

	aliasrun(2, STRunalias, STRpostcmd);
	xprintf(CGETS(22, 3, "Faulty alias 'postcmd' removed.\n"));
	goto leave;
    }
    postcmd_active = 1;
    if (!whyles && adrof1(STRpostcmd, &aliases))
	aliasrun(1, STRpostcmd, NULL);
leave:
    postcmd_active = 0;
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else /* !BSDSIGS */
    (void) sigrelse(SIGINT);
#endif /* BSDSIGS */
}

/*
 * Paul Placeway  11/24/87  Added cwd_cmd by hacking precmd() into
 * submission...  Run every time $cwd is set (after it is set).  Useful
 * for putting your machine and cwd (or anything else) in an xterm title
 * space.

exercises/compile-tcsh/tcsh-6.10.00/tc.func.c  view on Meta::CPAN

	aliasrun(2, STRunalias, STRcwdcmd);
	xprintf(CGETS(22, 4, "Faulty alias 'cwdcmd' removed.\n"));
	goto leave;
    }
    cwdcmd_active = 1;
    if (!whyles && adrof1(STRcwdcmd, &aliases))
	aliasrun(1, STRcwdcmd, NULL);
leave:
    cwdcmd_active = 0;
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else /* !BSDSIGS */
    (void) sigrelse(SIGINT);
#endif /* BSDSIGS */
}

/*
 * Joachim Hoenig  07/16/91  Added beep_cmd, run every time tcsh wishes 
 * to beep the terminal bell. Useful for playing nice sounds instead.
 */
void

exercises/compile-tcsh/tcsh-6.10.00/tc.func.c  view on Meta::CPAN

	aliasrun(2, STRunalias, STRbeepcmd);
	xprintf(CGETS(22, 5, "Faulty alias 'beepcmd' removed.\n"));
    }
    else {
	beepcmd_active = 1;
	if (!whyles && adrof1(STRbeepcmd, &aliases))
	    aliasrun(1, STRbeepcmd, NULL);
    }
    beepcmd_active = 0;
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else /* !BSDSIGS */
    (void) sigrelse(SIGINT);
#endif /* BSDSIGS */
}


/*
 * Karl Kleinpaste, 18 Jan 1984.
 * Added period_cmd(), which executes the alias "periodic" every
 * $tperiod minutes.  Useful for occasional checking of msgs and such.

exercises/compile-tcsh/tcsh-6.10.00/tc.func.c  view on Meta::CPAN

	interval = getn(vp);
	(void) time(&t);
	if (t - t_period >= interval * 60) {
	    t_period = t;
	    aliasrun(1, STRperiodic, NULL);
	}
    }
leave:
    periodic_active = 0;
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else /* !BSDSIGS */
    (void) sigrelse(SIGINT);
#endif /* BSDSIGS */
}

/*
 * Karl Kleinpaste, 21oct1983.
 * Set up a one-word alias command, for use for special things.
 * This code is based on the mainline of process().
 */

exercises/compile-tcsh/tcsh-6.10.00/tc.os.c  view on Meta::CPAN

    struct command *c;
{
    extern char *getenv();
    sigmask_t omask;
    Char  **pathvars, **cmdargs;
    char  **spaths, **cpaths, **cmds;
    char   *tcp;
    unsigned int npaths, ncmds;
    int     i, sysflag;

    omask = sigsetmask(sigmask(SIGINT));

    /*
     * setpath(3) uses stdio and we want 0, 1, 2 to work...
     */
    if (!didfds) {
	(void) dcopy(SHIN, 0);
	(void) dcopy(SHOUT, 1);
	(void) dcopy(SHDIAG, 2);
	didfds = 1;
    }

exercises/compile-tcsh/tcsh-6.10.00/tc.os.c  view on Meta::CPAN

	}
	if (cpaths)
	    xfree((ptr_t) cpaths);
	if (cmds) {
	    for (i = 0; i < ncmds; i++)
		if (cmds[i])
		    xfree((ptr_t) cmds[i]);
	    xfree((ptr_t) cmds);
	}

	(void) sigsetmask(omask);
	donefds();
	return;
    }

    for (i = 0; i < npaths; i++) {
	Char	*val, *name;

	name = str2short(cpaths[i]);
	for (val = str2short(cpaths[i]); val && *val && *val != '='; val++);
	if (val && *val == '=') {

exercises/compile-tcsh/tcsh-6.10.00/tc.os.c  view on Meta::CPAN


	    tsetenv(name, val);
	    if (Strcmp(name, STRKPATH) == 0) {
		importpath(val);
		if (havhash)
		    dohash(NULL, NULL);
	    }
	    *--val = '=';
	}
    }
    (void) sigsetmask(omask);
    donefds();
}
#endif /* MACH */

/***
 *** AIX
 ***/
#ifdef TCF
/* ARGSUSED */
void

exercises/compile-tcsh/tcsh-6.10.00/tc.os.c  view on Meta::CPAN

		    err1++;
	    }
	    v++;
	}
	if (gargv)
	    blkfree(gargv), gargv = 0;
    }

done:
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else
    (void) sigrelse(SIGCHLD);
    if (setintr)
	(void) sigrelse(SIGINT);
#endif /* BSDSIGS */
    if (err1)
	stderror(ERR_SILENT);
}

#endif /* TCF */

exercises/compile-tcsh/tcsh-6.10.00/tc.os.c  view on Meta::CPAN

	stderror(ERR_NAME | ERR_STRING, CGETS(23, 12, "Illegal universe"));
	    if (setintr)
#ifdef BSDSIGS
		omask = sigblock(sigmask(SIGINT)) & ~sigmask(SIGINT);
#else /* !BSDSIGS */
		(void) sighold(SIGINT);
#endif /* BSDSIGS */
	    lshift(v, 2);
	    if (setintr)
#ifdef BSDSIGS
		(void) sigsetmask(omask);
#else /* !BSDSIGS */
		(void) sigrelse (SIGINT);
#endif /* BSDSIGS */
	    reexecute(c);
	    (void) setuniverse(ubuf);
	}
    }
}
#endif /* masscomp || _CX_UX */

exercises/compile-tcsh/tcsh-6.10.00/tc.os.c  view on Meta::CPAN

	(void) setuniverse("att");
	if (setintr)
#ifdef BSDSIGS
	    omask = sigblock(sigmask(SIGINT)) & ~sigmask(SIGINT);
#else /* !BSDSIGS */
	    (void) sighold(SIGINT);
#endif /* BSDSIGS */
	lshift(v, 1);
	if (setintr)
#ifdef BSDSIGS
	    (void) sigsetmask(omask);
#else /* !BSDSIGS */
	    (void) sigrelse (SIGINT);
#endif /* BSDSIGS */
	reexecute(c);
	(void) setuniverse(ubuf);
    }
}

/*ARGSUSED*/
void

exercises/compile-tcsh/tcsh-6.10.00/tc.os.c  view on Meta::CPAN

	(void) setuniverse("ucb");
	if (setintr)
#ifdef BSDSIGS
	    omask = sigblock(sigmask(SIGINT)) & ~sigmask(SIGINT);
#else /* !BSDSIGS */
	    (void) sighold(SIGINT);
#endif /* BSDSIGS */
	lshift(v, 1);
	if (setintr)
#ifdef BSDSIGS
	    (void) sigsetmask(omask);
#else /* !BSDSIGS */
	    (void) sigrelse (SIGINT);
#endif /* BSDSIGS */
	reexecute(c);
	(void) setuniverse(ubuf);
    }
}
#endif /* _CX_UX */

#ifdef _SEQUENT_

exercises/compile-tcsh/tcsh-6.10.00/tc.os.h  view on Meta::CPAN

extern int sigpause();
#  else	/* !(_AIX370 || MACH || NeXT || _AIXPS2 || ardent || SUNOS4 || HPBSD) */
#   if (!defined(apollo) || !defined(__STDC__)) && !defined(__DGUX__) && !defined(fps500)
extern sigret_t sigvec();
#ifndef _CX_UX
extern void sigpause();
#endif /* _CX_UX */
#   endif /* (!apollo || !__STDC__) && !__DGUX__ && !fps500 */
#  endif /* _AIX370 || MACH || NeXT || _AIXPS2 || ardent || SUNOS4 || HPBSD */
extern sigmask_t sigblock();
extern sigmask_t sigsetmask();
# endif	/* BSDSIGS */

# ifndef killpg
extern int killpg();
# endif	/* killpg */

# ifndef lstat
extern int lstat();
# endif	/* lstat */

exercises/compile-tcsh/tcsh-6.10.00/tc.sched.c  view on Meta::CPAN

    tp = sched_ptr;

    /* bugfix by: Justin Bur at Universite de Montreal */
    /*
     * this test wouldn't be necessary if this routine were not called before
     * each prompt (in sh.c).  But it is, to catch missed alarms.  Someone
     * ought to fix it all up.  -jbb
     */
    if (!(tp && tp->t_when < cur_time)) {
#ifdef BSDSIGS
	(void) sigsetmask(omask);
#else
	(void) sigrelse(SIGINT);
#endif
	return;
    }

    if (GettingInput)
	(void) Cookedmode();

    while (tp && tp->t_when < cur_time) {

exercises/compile-tcsh/tcsh-6.10.00/tc.sched.c  view on Meta::CPAN

    }
    if (GettingInput && !just_signaled) {	/* PWP */
	(void) Rawmode();
	ClearLines();		/* do a real refresh since something may */
	ClearDisp();		/* have printed to the screen */
	Refresh();
    }
    just_signaled = 0;

#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else
    (void) sigrelse(SIGINT);
#endif
}

exercises/compile-tcsh/tcsh-6.10.00/tc.sig.c  view on Meta::CPAN

#ifdef DEBUG
# define SHOW_SIGNALS	1	/* to assist in debugging signals */
#endif /* DEBUG */

#ifdef SHOW_SIGNALS
char   *show_sig_mask();
#endif /* SHOW_SIGNALS */

#ifndef __PARAGON__
/*
 * sigsetmask(mask)
 *
 * Set a new signal mask.  Return old mask.
 */
sigmask_t
sigsetmask(mask)
    sigmask_t     mask;
{
    sigset_t set, oset;
    int     m;
    register int i;

    (void) sigemptyset(&set);
    (void) sigemptyset(&oset);

    for (i = 1; i <= MAXSIG; i++)
	if (ISSET(mask, i))
	    (void) sigaddset(&set, i);

    if ((sigprocmask(SIG_SETMASK, &set, &oset)) == -1) {
	xprintf("sigsetmask(0x%x) - sigprocmask failed, errno %d",
		mask, errno);
    }

    m = 0;
    for (i = 1; i <= MAXSIG; i++)
	if (sigismember(&oset, i))
	    SETBIT(m, i);

    return (m);
}

exercises/compile-tcsh/tcsh-6.10.00/tc.sig.h  view on Meta::CPAN

#   undef signal
#  endif /* WINNT_NATIVE */
#  define 	signal(a, b)	bsd_signal(a, b)
# endif /* POSIXSIGS */
# ifndef _SEQUENT_
#  define	sighold(s)	sigblock(sigmask(s))
#  define	sigignore(s)	signal(s, SIG_IGN)
#  define 	sigset(s, a)	signal(s, a)
# endif /* !_SEQUENT_ */
# ifdef aiws
#  define 	sigrelse(a)	sigsetmask(sigblock(0) & ~sigmask(a))
#  undef	killpg
#  define 	killpg(a, b)	kill(-getpgrp(a), b)
#  define	NEEDsignal
# endif /* aiws */
#endif /* BSDSIGS */


/*
 * We choose a define for the window signal if it exists..
 */

exercises/compile-tcsh/tcsh-6.10.00/tc.sig.h  view on Meta::CPAN

	    sigmask(SIGHUP)))

# define restoresigvec(sv, sm)					\
    (void) ((void) mysigvec(SIGINT,  &(sv)[0], (sigvec_t *) 0),	\
	    (void) mysigvec(SIGQUIT, &(sv)[1], (sigvec_t *) 0),	\
	    (void) mysigvec(SIGTSTP, &(sv)[2], (sigvec_t *) 0),	\
	    (void) mysigvec(SIGTTIN, &(sv)[3], (sigvec_t *) 0),	\
	    (void) mysigvec(SIGTTOU, &(sv)[4], (sigvec_t *) 0),	\
	    (void) mysigvec(SIGTERM, &(sv)[5], (sigvec_t *) 0),	\
	    (void) mysigvec(SIGHUP,  &(sv)[6], (sigvec_t *) 0),	\
	    (void) sigsetmask(sm))
# endif /* SAVESIGVEC */

#endif /* _h_tc_sig */

exercises/compile-tcsh/tcsh-6.10.00/tc.who.c  view on Meta::CPAN

    /* stop SIGINT, lest our login list get trashed. */
#ifdef BSDSIGS
    omask = sigblock(sigmask(SIGINT));
#else
    (void) sighold(SIGINT);
#endif

    v = adrof(STRwatch);
    if (v == NULL && !force) {
#ifdef BSDSIGS
	(void) sigsetmask(omask);
#else
	(void) sigrelse(SIGINT);
#endif
	return;			/* no names to watch */
    }
    if (!force) {
	trim(vp = v->vec);
	if (blklen(vp) % 2)		/* odd # args: 1st == # minutes. */
	    interval = (number(*vp)) ? (getn(*vp++) * 60) : MAILINTVL;
    }

exercises/compile-tcsh/tcsh-6.10.00/tc.who.c  view on Meta::CPAN

	if (!ncbs_posted) {
	    unsigned long tdiff = t - watch_period;
	    if (!watch_period || ((tdiff  > 0) && (tdiff > (interval - 90)))) {
		start_ncbs(vp);
 		ncbs_posted = 1;
	    }
	}
#endif /* WINNT_NATIVE */
    if (t - watch_period < interval) {
#ifdef BSDSIGS
	(void) sigsetmask(omask);
#else
	(void) sigrelse(SIGINT);
#endif
	return;			/* not long enough yet... */
    }
    watch_period = t;
#ifdef WINNT_NATIVE
    ncbs_posted = 0;
#else /* !WINNT_NATIVE */

    /*
     * From: Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de>
     * Don't open utmp all the time, stat it first...
     */
    if (stat(_PATH_UTMP, &sta)) {
	if (!force)
	    xprintf(CGETS(26, 1,
			  "cannot stat %s.  Please \"unset watch\".\n"),
		    _PATH_UTMP);
# ifdef BSDSIGS
	(void) sigsetmask(omask);
# else
	(void) sigrelse(SIGINT);
# endif
	return;
    }
    if (stlast == sta.st_mtime) {
# ifdef BSDSIGS
	(void) sigsetmask(omask);
# else
	(void) sigrelse(SIGINT);
# endif
	return;
    }
    stlast = sta.st_mtime;
    if ((utmpfd = open(_PATH_UTMP, O_RDONLY)) < 0) {
	if (!force)
	    xprintf(CGETS(26, 2,
			  "%s cannot be opened.  Please \"unset watch\".\n"),
		    _PATH_UTMP);
# ifdef BSDSIGS
	(void) sigsetmask(omask);
# else
	(void) sigrelse(SIGINT);
# endif
	return;
    }

    /*
     * xterm clears the entire utmp entry - mark everyone on the status list
     * OFFLINE or we won't notice X "logouts"
     */

exercises/compile-tcsh/tcsh-6.10.00/tc.who.c  view on Meta::CPAN

	    if (wp->who_status & CHANGED) {
		if (!firsttime)
		    print_who(wp);
		(void) strcpy(wp->who_name, wp->who_new);
		wp->who_status |= ANNOUNCE;
		continue;
	    }
	}
    }
#ifdef BSDSIGS
    (void) sigsetmask(omask);
#else
    (void) sigrelse(SIGINT);
#endif
}

#ifdef WHODEBUG
static void
debugwholist(new, wp)
    register struct who *new, *wp;
{

exercises/compile-tcsh/tcsh-6.10.00/tw.comp.c  view on Meta::CPAN

 *	Pretty print a list of variables
 */
static void
tw_prlist(p)
    struct varent *p;
{
    register struct varent *c;

    if (setintr)
#ifdef BSDSIGS
	(void) sigsetmask(sigblock((sigmask_t) 0) & ~sigmask(SIGINT));
#else				/* BSDSIGS */
	(void) sigrelse(SIGINT);
#endif				/* BSDSIGS */

    for (;;) {
	while (p->v_left)
	    p = p->v_left;
x:
	if (p->v_parent == 0)	/* is it the header? */
	    return;

exercises/compile-tcsh/tcsh-6.10.00/tw.init.c  view on Meta::CPAN

static struct {				/* Current element pointer	*/
    int    cur;				/* Current element number	*/
    Char **pathv;			/* Current element in path	*/
    DIR   *dfd;				/* Current directory descriptor	*/
} tw_cmd_state;


#ifdef BSDSIGS
static sigmask_t tw_omask;
# define TW_HOLD()	tw_omask = sigblock(sigmask(SIGINT))
# define TW_RELS()	(void) sigsetmask(tw_omask)
#else /* !BSDSIGS */
# define TW_HOLD()	(void) sighold(SIGINT)
# define TW_RELS()	(void) sigrelse(SIGINT)
#endif /* BSDSIGS */

#define SETDIR(dfd) \
    { \
	tw_dir_fd = dfd; \
	if (tw_dir_fd != NULL) \
	    rewinddir(tw_dir_fd); \



( run in 2.709 seconds using v1.01-cache-2.11-cpan-cc502c75498 )