Deleted Added
full compact
trap.c (217472) trap.c (218285)
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 217472 2011-01-16 13:56:41Z jilles $");
39__FBSDID("$FreeBSD: head/bin/sh/trap.c 218285 2011-02-04 16:40:50Z jilles $");
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 */

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

96sigstring_to_signum(char *sig)
97{
98
99 if (is_number(sig)) {
100 int signo;
101
102 signo = atoi(sig);
103 return ((signo >= 0 && signo < NSIG) ? signo : (-1));
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 */

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

96sigstring_to_signum(char *sig)
97{
98
99 if (is_number(sig)) {
100 int signo;
101
102 signo = atoi(sig);
103 return ((signo >= 0 && signo < NSIG) ? signo : (-1));
104 } else if (strcasecmp(sig, "exit") == 0) {
104 } else if (strcasecmp(sig, "EXIT") == 0) {
105 return (0);
106 } else {
107 int n;
108
105 return (0);
106 } else {
107 int n;
108
109 if (strncasecmp(sig, "sig", 3) == 0)
109 if (strncasecmp(sig, "SIG", 3) == 0)
110 sig += 3;
111 for (n = 1; n < sys_nsig; n++)
112 if (sys_signame[n] &&
113 strcasecmp(sys_signame[n], sig) == 0)
114 return (n);
115 }
116 return (-1);
117}

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

166 argv = argptr;
167
168 if (*argv == NULL) {
169 for (signo = 0 ; signo < sys_nsig ; signo++) {
170 if (signo < NSIG && trap[signo] != NULL) {
171 out1str("trap -- ");
172 out1qstr(trap[signo]);
173 if (signo == 0) {
110 sig += 3;
111 for (n = 1; n < sys_nsig; n++)
112 if (sys_signame[n] &&
113 strcasecmp(sys_signame[n], sig) == 0)
114 return (n);
115 }
116 return (-1);
117}

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

166 argv = argptr;
167
168 if (*argv == NULL) {
169 for (signo = 0 ; signo < sys_nsig ; signo++) {
170 if (signo < NSIG && trap[signo] != NULL) {
171 out1str("trap -- ");
172 out1qstr(trap[signo]);
173 if (signo == 0) {
174 out1str(" exit\n");
174 out1str(" EXIT\n");
175 } else if (sys_signame[signo]) {
176 out1fmt(" %s\n", sys_signame[signo]);
177 } else {
178 out1fmt(" %d\n", signo);
179 }
180 }
181 }
182 return 0;

--- 356 unchanged lines hidden ---
175 } else if (sys_signame[signo]) {
176 out1fmt(" %s\n", sys_signame[signo]);
177 } else {
178 out1fmt(" %d\n", signo);
179 }
180 }
181 }
182 return 0;

--- 356 unchanged lines hidden ---