Convert to raise_default_signal(3).

This commit is contained in:
lukem 2007-10-05 07:27:41 +00:00
parent db822d2217
commit 5d427989ff
10 changed files with 46 additions and 33 deletions

View File

@ -1,7 +1,10 @@
# $NetBSD: Makefile,v 1.2 2002/01/13 04:43:18 ross Exp $
# $NetBSD: Makefile,v 1.3 2007/10/05 07:27:41 lukem Exp $
WARNS= 2
PROG= audioplay
SRCS= play.c
DPADD+= ${LIBUTIL}
LDADD+= -lutil
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: play.c,v 1.46 2006/05/23 01:07:16 christos Exp $ */
/* $NetBSD: play.c,v 1.47 2007/10/05 07:27:41 lukem Exp $ */
/*
* Copyright (c) 1999 Matthew R. Green
@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: play.c,v 1.46 2006/05/23 01:07:16 christos Exp $");
__RCSID("$NetBSD: play.c,v 1.47 2007/10/05 07:27:41 lukem Exp $");
#endif
@ -47,6 +47,7 @@ __RCSID("$NetBSD: play.c,v 1.46 2006/05/23 01:07:16 christos Exp $");
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <util.h>
#include <paths.h>
@ -207,6 +208,9 @@ cleanup(signo)
(void)ioctl(audiofd, AUDIO_FLUSH, NULL);
(void)ioctl(audiofd, AUDIO_SETINFO, &info);
close(audiofd);
if (signo != 0) {
(void)raise_default_signal(signo);
}
exit(exitstatus);
}

View File

@ -1,6 +1,9 @@
# $NetBSD: Makefile,v 1.1 1999/03/26 14:02:41 mrg Exp $
# $NetBSD: Makefile,v 1.2 2007/10/05 07:27:41 lukem Exp $
PROG= audiorecord
SRCS= record.c
DPADD+= ${LIBUTIL}
LDADD+= -lutil
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: record.c,v 1.43 2006/05/11 01:19:10 mrg Exp $ */
/* $NetBSD: record.c,v 1.44 2007/10/05 07:27:41 lukem Exp $ */
/*
* Copyright (c) 1999, 2002 Matthew R. Green
@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: record.c,v 1.43 2006/05/11 01:19:10 mrg Exp $");
__RCSID("$NetBSD: record.c,v 1.44 2007/10/05 07:27:41 lukem Exp $");
#endif
@ -52,6 +52,7 @@ __RCSID("$NetBSD: record.c,v 1.43 2006/05/11 01:19:10 mrg Exp $");
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <util.h>
#include "libaudio.h"
#include "auconv.h"
@ -374,6 +375,9 @@ cleanup(signo)
err(1, "failed to reset audio info");
}
close(audiofd);
if (signo != 0) {
(void)raise_default_signal(signo);
}
exit(0);
}

View File

@ -1,6 +1,9 @@
# $NetBSD: Makefile,v 1.1 2006/09/25 19:21:42 christos Exp $
# $NetBSD: Makefile,v 1.2 2007/10/05 07:27:42 lukem Exp $
WARNS=4
WARNS= 4
PROG= csplit
DPADD+= ${LIBUTIL}
LDADD+= -lutil
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: csplit.c,v 1.2 2007/07/18 01:32:33 lukem Exp $ */
/* $NetBSD: csplit.c,v 1.3 2007/10/05 07:27:42 lukem Exp $ */
/* $FreeBSD: src/usr.bin/csplit/csplit.c,v 1.9 2004/03/22 11:15:03 tjr Exp$ */
/*-
@ -47,7 +47,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: csplit.c,v 1.2 2007/07/18 01:32:33 lukem Exp $");
__RCSID("$NetBSD: csplit.c,v 1.3 2007/10/05 07:27:42 lukem Exp $");
#endif
#include <sys/types.h>
@ -64,6 +64,7 @@ __RCSID("$NetBSD: csplit.c,v 1.2 2007/07/18 01:32:33 lukem Exp $");
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <util.h>
static void cleanup(void);
static void do_lineno(const char *);
@ -228,24 +229,13 @@ handlesig(int sig)
{
char msg[BUFSIZ];
size_t len;
struct sigaction n_hand;
sigset_t n_mask;
len = snprintf(msg, sizeof(msg), "%s: Caught %s, cleaning up\n",
getprogname(), strsignal(sig));
if (len < sizeof(msg))
(void)write(STDERR_FILENO, msg, len);
cleanup();
/* Reset to default signal handler, clear mask, raise signal */
memset(&n_hand, 0, sizeof n_hand);
sigemptyset(&n_hand.sa_mask);
n_hand.sa_handler = SIG_DFL;
if ((sigaction(sig, &n_hand, NULL) == 0) &&
(sigemptyset(&n_mask) == 0) &&
(sigaddset(&n_mask, sig) == 0) &&
(sigprocmask(SIG_UNBLOCK, &n_mask, 0) == 0)) {
raise(sig);
}
(void)raise_default_signal(sig);
_exit(2);
}

View File

@ -1,7 +1,10 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
# $NetBSD: Makefile,v 1.5 2006/10/08 17:52:28 peter Exp $
# $NetBSD: Makefile,v 1.6 2007/10/05 07:27:42 lukem Exp $
PROG= error
SRCS= main.c input.c pi.c subr.c filter.c touch.c
DPADD+= ${LIBUTIL}
LDADD+= -lutil
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: touch.c,v 1.15 2007/07/19 05:43:23 lukem Exp $ */
/* $NetBSD: touch.c,v 1.16 2007/10/05 07:27:42 lukem Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: touch.c,v 1.15 2007/07/19 05:43:23 lukem Exp $");
__RCSID("$NetBSD: touch.c,v 1.16 2007/10/05 07:27:42 lukem Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -45,6 +45,7 @@ __RCSID("$NetBSD: touch.c,v 1.15 2007/07/19 05:43:23 lukem Exp $");
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <util.h>
#include <stdarg.h>
#include "error.h"
#include "pathnames.h"
@ -696,14 +697,14 @@ mustwrite(char *base, int n, FILE *preciousfile)
}
void
onintr(int dummy)
onintr(int sig)
{
switch(inquire(terse
? "\nContinue? "
: "\nInterrupt: Do you want to continue? ")){
case Q_YES:
case Q_yes:
signal(SIGINT, onintr);
signal(sig, onintr);
return;
case Q_error:
default:
@ -713,7 +714,8 @@ onintr(int dummy)
*/
writetouched(0);
}
exit(1);
(void)raise_default_signal(sig);
_exit(127);
}
/*NOTREACHED*/
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: last.c,v 1.30 2007/01/06 13:31:06 cbiere Exp $ */
/* $NetBSD: last.c,v 1.31 2007/10/05 07:27:42 lukem Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -40,7 +40,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)last.c 8.2 (Berkeley) 4/2/94";
#endif
__RCSID("$NetBSD: last.c,v 1.30 2007/01/06 13:31:06 cbiere Exp $");
__RCSID("$NetBSD: last.c,v 1.31 2007/10/05 07:27:42 lukem Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -50,7 +50,6 @@ __RCSID("$NetBSD: last.c,v 1.30 2007/01/06 13:31:06 cbiere Exp $");
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: want.c,v 1.10 2007/01/06 14:29:44 cbiere Exp $ */
/* $NetBSD: want.c,v 1.11 2007/10/05 07:27:42 lukem Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -305,7 +305,9 @@ onintr(int signo)
/* FIXME: None of this is allowed in a signal handler */
printf("\ninterrupted %s\n", fmttime(buf[FIRSTVALID].ut_timefld,
FULLTIME));
if (signo == SIGINT)
if (signo == SIGINT) {
(void)raise_default_signal(signo);
exit(EXIT_FAILURE);
}
(void)fflush(stdout); /* fix required for rsh */
}