summaryrefslogtreecommitdiff
path: root/src/tac.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1995-10-04 03:46:35 +0000
committerJim Meyering <jim@meyering.net>1995-10-04 03:46:35 +0000
commita9de4d485ab79fd92396d35722c118dbe3b649e0 (patch)
treef19a87ed66ad7b7e35c55dbbd3e89c88d9ecfeb1 /src/tac.c
parent111cb717e8a982aa7030b891c99cd2c9c135bf22 (diff)
downloadcoreutils-a9de4d485ab79fd92396d35722c118dbe3b649e0.tar.xz
Test SA_INTERRUPT, not _POSIX_VERSION,
to determine whether `sigaction' functions are available. Reported by Paul Nevai <nevai@ops.mps.ohio-state.edu>. Fix suggested by Karl Berry.
Diffstat (limited to 'src/tac.c')
-rw-r--r--src/tac.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/tac.c b/src/tac.c
index 49af8b251..d2f59ab7c 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -270,9 +270,9 @@ tac_stdin ()
RETSIGTYPE (*sigint) (), (*sighup) (), (*sigpipe) (), (*sigterm) ();
int errors;
struct stat stats;
-#ifdef _POSIX_VERSION
+#ifdef SA_INTERRUPT
struct sigaction oldact, newact;
-#endif /* _POSIX_VERSION */
+#endif /* SA_INTERRUPT */
/* No tempfile is needed for "tac < file".
Use fstat instead of checking for errno == ESPIPE because
@@ -286,7 +286,7 @@ tac_stdin ()
if (S_ISREG (stats.st_mode))
return tac (0, _("standard input"));
-#ifdef _POSIX_VERSION
+#ifdef SA_INTERRUPT
newact.sa_handler = cleanup;
sigemptyset (&newact.sa_mask);
newact.sa_flags = 0;
@@ -310,7 +310,7 @@ tac_stdin ()
sigterm = oldact.sa_handler;
if (sigterm != SIG_IGN)
sigaction (SIGTERM, &newact, NULL);
-#else /* !_POSIX_VERSION */
+#else /* !SA_INTERRUPT */
sigint = signal (SIGINT, SIG_IGN);
if (sigint != SIG_IGN)
signal (SIGINT, cleanup);
@@ -326,7 +326,7 @@ tac_stdin ()
sigterm = signal (SIGTERM, SIG_IGN);
if (sigterm != SIG_IGN)
signal (SIGTERM, cleanup);
-#endif /* _POSIX_VERSION */
+#endif /* SA_INTERRUPT */
save_stdin ();
@@ -334,7 +334,7 @@ tac_stdin ()
unlink (tempfile);
-#ifdef _POSIX_VERSION
+#ifdef SA_INTERRUPT
newact.sa_handler = sigint;
sigaction (SIGINT, &newact, NULL);
newact.sa_handler = sighup;
@@ -343,12 +343,12 @@ tac_stdin ()
sigaction (SIGTERM, &newact, NULL);
newact.sa_handler = sigpipe;
sigaction (SIGPIPE, &newact, NULL);
-#else /* !_POSIX_VERSION */
+#else /* !SA_INTERRUPT */
signal (SIGINT, sigint);
signal (SIGHUP, sighup);
signal (SIGTERM, sigterm);
signal (SIGPIPE, sigpipe);
-#endif /* _POSIX_VERSION */
+#endif /* SA_INTERRUPT */
return errors;
}