Deleted Added
full compact
trap.c (213760) trap.c (213811)
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 213760 2010-10-13 04:01:01Z obrien $");
39__FBSDID("$FreeBSD: head/bin/sh/trap.c 213811 2010-10-13 22:18:03Z obrien $");
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 */

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

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];
79 /* indicates specified signal received */
80static int ignore_sigchld; /* Used while handling SIGCHLD traps. */
81volatile sig_atomic_t gotwinch;
82
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 */

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

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];
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 *);
83static int getsigaction(int, sig_t *);
84
85
86/*
87 * Map a string to a signal number.
88 *
89 * Note: the signal number may exceed NSIG.
90 */
84
85
86/*
87 * Map a string to a signal number.
88 *
89 * Note: the signal number may exceed NSIG.
90 */
91STATIC int
91static int
92sigstring_to_signum(char *sig)
93{
94
95 if (is_number(sig)) {
96 int signo;
97
98 signo = atoi(sig);
99 return ((signo >= 0 && signo < NSIG) ? signo : (-1));

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

111 }
112 return (-1);
113}
114
115
116/*
117 * Print a list of valid signal names.
118 */
92sigstring_to_signum(char *sig)
93{
94
95 if (is_number(sig)) {
96 int signo;
97
98 signo = atoi(sig);
99 return ((signo >= 0 && signo < NSIG) ? signo : (-1));

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

111 }
112 return (-1);
113}
114
115
116/*
117 * Print a list of valid signal names.
118 */
119STATIC void
119static void
120printsignals(void)
121{
122 int n, outlen;
123
124 outlen = 0;
125 for (n = 1; n < sys_nsig; n++) {
126 if (sys_signame[n]) {
127 out1fmt("%s", sys_signame[n]);

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

329 sigemptyset(&sa.sa_mask);
330 sigaction(signo, &sa, NULL);
331}
332
333
334/*
335 * Return the current setting for sig w/o changing it.
336 */
120printsignals(void)
121{
122 int n, outlen;
123
124 outlen = 0;
125 for (n = 1; n < sys_nsig; n++) {
126 if (sys_signame[n]) {
127 out1fmt("%s", sys_signame[n]);

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

329 sigemptyset(&sa.sa_mask);
330 sigaction(signo, &sa, NULL);
331}
332
333
334/*
335 * Return the current setting for sig w/o changing it.
336 */
337STATIC int
337static int
338getsigaction(int signo, sig_t *sigact)
339{
340 struct sigaction sa;
341
342 if (sigaction(signo, (struct sigaction *)0, &sa) == -1)
343 return 0;
344 *sigact = (sig_t) sa.sa_handler;
345 return 1;

--- 157 unchanged lines hidden ---
338getsigaction(int signo, sig_t *sigact)
339{
340 struct sigaction sa;
341
342 if (sigaction(signo, (struct sigaction *)0, &sa) == -1)
343 return 0;
344 *sigact = (sig_t) sa.sa_handler;
345 return 1;

--- 157 unchanged lines hidden ---