Deleted Added
full compact
trap.c (153244) trap.c (157811)
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 22 unchanged lines hidden (view full) ---

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 22 unchanged lines hidden (view full) ---

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/bin/sh/trap.c 153244 2005-12-08 20:08:36Z stefanf $");
39__FBSDID("$FreeBSD: head/bin/sh/trap.c 157811 2006-04-17 17:55:11Z schweikh $");
40
41#include <signal.h>
42#include <unistd.h>
43#include <stdlib.h>
44
45#include "shell.h"
46#include "main.h"
47#include "nodes.h" /* for other headers */

--- 22 unchanged lines hidden (view full) ---

70#define S_HARD_IGN 4 /* signal is ignored permanently */
71#define S_RESET 5 /* temporary - to reset a hard ignored sig */
72
73
74MKINIT char sigmode[NSIG]; /* current value of signal */
75int pendingsigs; /* indicates some signal received */
76int in_dotrap; /* do we execute in a trap handler? */
77static char *volatile trap[NSIG]; /* trap handler commands */
40
41#include <signal.h>
42#include <unistd.h>
43#include <stdlib.h>
44
45#include "shell.h"
46#include "main.h"
47#include "nodes.h" /* for other headers */

--- 22 unchanged lines hidden (view full) ---

70#define S_HARD_IGN 4 /* signal is ignored permanently */
71#define S_RESET 5 /* temporary - to reset a hard ignored sig */
72
73
74MKINIT char sigmode[NSIG]; /* current value of signal */
75int pendingsigs; /* indicates some signal received */
76int in_dotrap; /* do we execute in a trap handler? */
77static char *volatile trap[NSIG]; /* trap handler commands */
78static volatile sig_atomic_t gotsig[NSIG];
78static volatile sig_atomic_t gotsig[NSIG];
79 /* indicates specified signal received */
80static int ignore_sigchld; /* Used while handling SIGCHLD traps. */
81volatile sig_atomic_t gotwinch;
82
83static int getsigaction(int, sig_t *);
84
85
86/*

--- 283 unchanged lines hidden (view full) ---

370
371 if (signo != SIGCHLD || !ignore_sigchld)
372 gotsig[signo] = 1;
373 pendingsigs++;
374
375 /* If we are currently in a wait builtin, prepare to break it */
376 if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0)
377 breakwaitcmd = 1;
79 /* indicates specified signal received */
80static int ignore_sigchld; /* Used while handling SIGCHLD traps. */
81volatile sig_atomic_t gotwinch;
82
83static int getsigaction(int, sig_t *);
84
85
86/*

--- 283 unchanged lines hidden (view full) ---

370
371 if (signo != SIGCHLD || !ignore_sigchld)
372 gotsig[signo] = 1;
373 pendingsigs++;
374
375 /* If we are currently in a wait builtin, prepare to break it */
376 if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0)
377 breakwaitcmd = 1;
378 /*
379 * If a trap is set, not ignored and not the null command, we need
378 /*
379 * If a trap is set, not ignored and not the null command, we need
380 * to make sure traps are executed even when a child blocks signals.
381 */
382 if (Tflag &&
380 * to make sure traps are executed even when a child blocks signals.
381 */
382 if (Tflag &&
383 trap[signo] != NULL &&
383 trap[signo] != NULL &&
384 ! (trap[signo][0] == '\0') &&
385 ! (trap[signo][0] == ':' && trap[signo][1] == '\0'))
386 breakwaitcmd = 1;
387
388#ifndef NO_HISTORY
389 if (signo == SIGWINCH)
390 gotwinch = 1;
391#endif

--- 91 unchanged lines hidden ---
384 ! (trap[signo][0] == '\0') &&
385 ! (trap[signo][0] == ':' && trap[signo][1] == '\0'))
386 breakwaitcmd = 1;
387
388#ifndef NO_HISTORY
389 if (signo == SIGWINCH)
390 gotwinch = 1;
391#endif

--- 91 unchanged lines hidden ---