trap.c (38950) | trap.c (39049) |
---|---|
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 --- 25 unchanged lines hidden (view full) --- 34 * SUCH DAMAGE. 35 */ 36 37#ifndef lint 38#if 0 39static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95"; 40#endif 41static const char rcsid[] = | 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 --- 25 unchanged lines hidden (view full) --- 34 * SUCH DAMAGE. 35 */ 36 37#ifndef lint 38#if 0 39static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95"; 40#endif 41static const char rcsid[] = |
42 "$Id: trap.c,v 1.14 1998/08/25 09:33:34 cracauer Exp $"; | 42 "$Id: trap.c,v 1.15 1998/09/08 13:16:52 cracauer Exp $"; |
43#endif /* not lint */ 44 45#include <signal.h> 46#include <unistd.h> 47#include <stdlib.h> 48 49#include "shell.h" 50#include "main.h" --- 291 unchanged lines hidden (view full) --- 342 343/* 344 * Signal handler. 345 */ 346void 347onsig(signo) 348 int signo; 349{ | 43#endif /* not lint */ 44 45#include <signal.h> 46#include <unistd.h> 47#include <stdlib.h> 48 49#include "shell.h" 50#include "main.h" --- 291 unchanged lines hidden (view full) --- 342 343/* 344 * Signal handler. 345 */ 346void 347onsig(signo) 348 int signo; 349{ |
350 int i; | |
351 352#ifndef BSD 353 signal(signo, onsig); 354#endif 355 if (signo == SIGINT && trap[SIGINT] == NULL) { 356 onint(); 357 return; 358 } --- 4 unchanged lines hidden (view full) --- 363 364 /* If we are currently in a wait builtin, prepare to break it */ 365 if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0) 366 breakwaitcmd = 1; 367 /* 368 * If a trap is set, we need to make sure it is executed even 369 * when a childs blocks all signals. 370 */ | 350 351#ifndef BSD 352 signal(signo, onsig); 353#endif 354 if (signo == SIGINT && trap[SIGINT] == NULL) { 355 onint(); 356 return; 357 } --- 4 unchanged lines hidden (view full) --- 362 363 /* If we are currently in a wait builtin, prepare to break it */ 364 if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0) 365 breakwaitcmd = 1; 366 /* 367 * If a trap is set, we need to make sure it is executed even 368 * when a childs blocks all signals. 369 */ |
371 for (i = 0; i < NSIG; i++) { 372 if (signo == i && trap[i] != NULL && 373 ! (trap[i][0] == ':' && trap[i][1] == '\0')) { 374 breakwaitcmd = 1; 375 break; 376 } 377 } | 370 if (trap[signo] != NULL && 371 ! (trap[signo][0] == ':' && trap[signo][1] == '\0')) 372 breakwaitcmd = 1; |
378} 379 380 381/* 382 * Called to execute a trap. Perhaps we should avoid entering new trap 383 * handlers while we are executing a trap handler. 384 */ 385void --- 81 unchanged lines hidden --- | 373} 374 375 376/* 377 * Called to execute a trap. Perhaps we should avoid entering new trap 378 * handlers while we are executing a trap handler. 379 */ 380void --- 81 unchanged lines hidden --- |