122111Smckusick /* 222111Smckusick * Copyright (c) 1985 Regents of the University of California. 3*35307Sbostic * All rights reserved. 4*35307Sbostic * 5*35307Sbostic * Redistribution and use in source and binary forms are permitted 6*35307Sbostic * provided that the above copyright notice and this paragraph are 7*35307Sbostic * duplicated in all such forms and that any documentation, 8*35307Sbostic * advertising materials, and other materials related to such 9*35307Sbostic * distribution and use acknowledge that the software was developed 10*35307Sbostic * by the University of California, Berkeley. The name of the 11*35307Sbostic * University may not be used to endorse or promote products derived 12*35307Sbostic * from this software without specific prior written permission. 13*35307Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14*35307Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15*35307Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1622111Smckusick */ 1718296Smckusick 1826592Sdonn #if defined(LIBC_SCCS) && !defined(lint) 19*35307Sbostic static char sccsid[] = "@(#)signal.c 5.3 (Berkeley) 08/02/88"; 20*35307Sbostic #endif /* LIBC_SCCS and not lint */ 2122111Smckusick 2216498Sralph /* 2316498Sralph * Almost backwards compatible signal. 2416498Sralph */ 2518296Smckusick #include <signal.h> 2616498Sralph 2718296Smckusick int (* 2818296Smckusick signal(s, a))() 2918296Smckusick int s, (*a)(); 3018296Smckusick { 3118296Smckusick struct sigvec osv, sv; 3218296Smckusick static int mask[NSIG]; 3318296Smckusick static int flags[NSIG]; 3418296Smckusick 3518296Smckusick sv.sv_handler = a; 3618296Smckusick sv.sv_mask = mask[s]; 3718296Smckusick sv.sv_flags = flags[s]; 3818296Smckusick if (sigvec(s, &sv, &osv) < 0) 3918296Smckusick return (BADSIG); 4018296Smckusick if (sv.sv_mask != osv.sv_mask || sv.sv_flags != osv.sv_flags) { 4118296Smckusick mask[s] = sv.sv_mask = osv.sv_mask; 4218296Smckusick flags[s] = sv.sv_flags = osv.sv_flags; 4318296Smckusick if (sigvec(s, &sv, 0) < 0) 4418296Smckusick return (BADSIG); 4518296Smckusick } 4618296Smckusick return (osv.sv_handler); 4718296Smckusick } 48