From 159ebfdd91843aee78e1dd1b36b33d282f8e9799 Mon Sep 17 00:00:00 2001 From: moritz Date: Wed, 28 Feb 2007 13:53:58 +0000 Subject: [PATCH] Back out hardly used ezsignals.h. git-svn-id: https://svn.xiph.org/trunk/ezstream@12589 0101bb08-14d6-0310-b084-bc0e0c8e3800 --- src/Makefile.am | 3 +-- src/ezsignals.h | 58 ------------------------------------------------- src/ezstream.c | 10 +++++++-- 3 files changed, 9 insertions(+), 62 deletions(-) delete mode 100644 src/ezsignals.h diff --git a/src/Makefile.am b/src/Makefile.am index 9b2240d..792fb1c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,7 +8,6 @@ ezstream_LDADD = @LIBOBJS@ @XIPH_LIBS@ AM_CFLAGS = @XIPH_CFLAGS@ AM_CPPFLAGS = @XIPH_CPPFLAGS@ -EXTRA_DIST = configfile.h ezsignals.h getopt.h playlist.h strlfctns.h \ - util.h +EXTRA_DIST = configfile.h getopt.h playlist.h strlfctns.h util.h CLEANFILES = core *.core *~ .*~ diff --git a/src/ezsignals.h b/src/ezsignals.h deleted file mode 100644 index bb0b246..0000000 --- a/src/ezsignals.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2007 Moritz Grimm - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* Macros to install, suspend and restore signals */ - -#ifndef __EZSIGNALS_H__ -#define __EZSIGNALS_H__ - -#define SIGS_INSTALL(a, b) do { \ - unsigned int i; \ - for (i = 0; i < sizeof(a) / sizeof(int); i++) { \ - if (sigaction((a)[i], (b), NULL) == -1) { \ - printf("%s: sigaction(): %s\n", \ - __progname, strerror(errno)); \ - return (1); \ - } \ - } \ -} while (0); - -#define SIGS_SUSPEND(a, b) do { \ - unsigned int i; \ - sigset_t sigset; \ - sigemptyset(&sigset); \ - for (i = 0; i < sizeof(a) / sizeof(int); i++) { \ - if (sigaddset(&sigset, (a)[i]) == -1) \ - printf("%s: sigaddset(): %s\n", \ - __progname, strerror(errno)); \ - exit(1); \ - } \ - if (sigprocmask(SIG_BLOCK, &sigset, (b)) == -1) { \ - printf("%s: sigprocmask(): %s\n", __progname, \ - strerror(errno)); \ - exit(1); \ - } \ -} while (0); - -#define SIGS_RESTORE(a) do { \ - if (sigprocmask(SIG_SETMASK, (a), NULL) == -1) { \ - printf("%s: sigprocmask(): %s\n", __progname, \ - strerror(errno)); \ - exit(1); \ - } \ -} while (0); - -#endif /* __EZSIGNALS_H__ */ diff --git a/src/ezstream.c b/src/ezstream.c index bc7406e..57a3da6 100644 --- a/src/ezstream.c +++ b/src/ezstream.c @@ -58,7 +58,6 @@ # include "strlfctns.h" #endif #include "configfile.h" -#include "ezsignals.h" #include "playlist.h" #include "util.h" @@ -817,6 +816,7 @@ main(int argc, char *argv[]) extern int optind; #ifdef HAVE_SIGNALS struct sigaction act; + unsigned int i; #endif __progname = getProgname(argv[0]); @@ -1048,7 +1048,13 @@ main(int argc, char *argv[]) # ifdef SA_RESTART act.sa_flags = SA_RESTART; # endif - SIGS_INSTALL(ezstream_signals, &act); + for (i = 0; i < sizeof(ezstream_signals) / sizeof(int); i++) { + if (sigaction(ezstream_signals[i], &act, NULL) == -1) { + printf("%s: sigaction(): %s\n", + __progname, strerror(errno)); + return (1); + } + } #endif /* HAVE_SIGNALS */ if (qFlag) {