/*
 *      @(#)Copyright (c) 1993, Simon J. Gerraty.
 *      
 *      This is free software.  It comes with NO WARRANTY.
 *      Permission to use, modify and distribute this source code 
 *      is granted subject to the following conditions.
 *      1/ that the above copyright notice and this notice 
 *      are preserved in all copies and that due credit be given 
 *      to the author.  
 *      2/ that any changes to this code are clearly commented 
 *      as such so that the author does not get blamed for bugs 
 *      other than his own.
 *      
 *      Please send copies of changes and bug-fixes to:
 *      sjg@quick.com.au
 */
/*
 *	from: sigact.c,v 1.11 1994/01/24 22:04:28 sjg 
 */
#include <sigact.h>
#ifndef lint
static char RCSid[] = "$Id: sig.c,v 1.3 1997/02/08 07:11:22 sjg Exp $";
#endif

/*
 * an implementation of signal() using sigaction().
 * Useful on BSD to get SysV signal handling (we use restart==0)
 */

int _SignalFlags = 0;				/* no auto-restart */

SIG_HDLR (*Signal(sig, handler)) __P((int))
  int sig;
  SIG_HDLR (*handler) __P((int));
{
  struct sigaction act, oact;

  act.sa_handler = handler;
  sigemptyset(&act.sa_mask);
  act.sa_flags = _SignalFlags;
  if (sigaction(sig, &act, &oact) < 0)
    return (SIG_ERR);
  return (oact.sa_handler);
}
