]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Test SA_INTERRUPT, not _POSIX_VERSION,
authorJim Meyering <jim@meyering.net>
Wed, 4 Oct 1995 03:46:35 +0000 (03:46 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 4 Oct 1995 03:46:35 +0000 (03:46 +0000)
to determine whether `sigaction' functions are available.
Reported by Paul Nevai <nevai@ops.mps.ohio-state.edu>.
Fix suggested by Karl Berry.

src/csplit.c
src/sort.c
src/tac.c

index e80917d17363366af3b2c8f7c9adca580aa35062..a81144a6682ba58b1475710f465094ac0f2a094c 100644 (file)
@@ -1435,9 +1435,9 @@ main (argc, argv)
      char **argv;
 {
   int optc;
-#ifdef _POSIX_VERSION
+#ifdef SA_INTERRUPT
   struct sigaction oldact, newact;
-#endif                         /* _POSIX_VERSION */
+#endif                         /* SA_INTERRUPT */
 
   program_name = argv[0];
   global_argv = argv;
@@ -1447,7 +1447,7 @@ main (argc, argv)
   remove_files = TRUE;
   prefix = DEFAULT_PREFIX;
 
-#ifdef _POSIX_VERSION
+#ifdef SA_INTERRUPT
   newact.sa_handler = interrupt_handler;
   sigemptyset (&newact.sa_mask);
   newact.sa_flags = 0;
@@ -1467,7 +1467,7 @@ main (argc, argv)
   sigaction (SIGTERM, NULL, &oldact);
   if (oldact.sa_handler != SIG_IGN)
     sigaction (SIGTERM, &newact, NULL);
-#else                          /* !_POSIX_VERSION */
+#else
   if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
     signal (SIGHUP, interrupt_handler);
   if (signal (SIGINT, SIG_IGN) != SIG_IGN)
index 787b22076c94919847c8c34af7152ae610cd859c..87f2fb469f035d4a827774f961c7e24d26882430 100644 (file)
@@ -32,7 +32,7 @@
 #include "long-options.h"
 #include "error.h"
 
-#ifdef _POSIX_VERSION
+#ifdef HAVE_LIMITS_H
 #include <limits.h>
 #else
 #ifndef UCHAR_MAX
@@ -1411,16 +1411,16 @@ static void
 sighandler (sig)
      int sig;
 {
-#ifdef _POSIX_VERSION
+#ifdef SA_INTERRUPT
   struct sigaction sigact;
 
   sigact.sa_handler = SIG_DFL;
   sigemptyset (&sigact.sa_mask);
   sigact.sa_flags = 0;
   sigaction (sig, &sigact, NULL);
-#else                          /* !_POSIX_VERSION */
+#else                          /* !SA_INTERRUPT */
   signal (sig, SIG_DFL);
-#endif                         /* _POSIX_VERSION */
+#endif                         /* SA_INTERRUPT */
   cleanup ();
   kill (getpid (), sig);
 }
@@ -1492,9 +1492,9 @@ main (argc, argv)
   int checkonly = 0, mergeonly = 0, nfiles = 0;
   char *minus = "-", *outfile = minus, **files, *tmp;
   FILE *ofp;
-#ifdef _POSIX_VERSION
+#ifdef SA_INTERRUPT
   struct sigaction oldact, newact;
-#endif                         /* _POSIX_VERSION */
+#endif                         /* SA_INTERRUPT */
 
   program_name = argv[0];
 
@@ -1507,7 +1507,7 @@ main (argc, argv)
   if (temp_file_prefix == NULL)
     temp_file_prefix = DEFAULT_TMPDIR;
 
-#ifdef _POSIX_VERSION
+#ifdef SA_INTERRUPT
   newact.sa_handler = sighandler;
   sigemptyset (&newact.sa_mask);
   newact.sa_flags = 0;
@@ -1524,7 +1524,7 @@ main (argc, argv)
   sigaction (SIGTERM, NULL, &oldact);
   if (oldact.sa_handler != SIG_IGN)
     sigaction (SIGTERM, &newact, NULL);
-#else                          /* !_POSIX_VERSION */
+#else                          /* !SA_INTERRUPT */
   if (signal (SIGINT, SIG_IGN) != SIG_IGN)
     signal (SIGINT, sighandler);
   if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
@@ -1533,7 +1533,7 @@ main (argc, argv)
     signal (SIGPIPE, sighandler);
   if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
     signal (SIGTERM, sighandler);
-#endif                         /* !_POSIX_VERSION */
+#endif                         /* !SA_INTERRUPT */
 
   gkey.sword = gkey.eword = -1;
   gkey.ignore = NULL;
index 49af8b251b7077d01e21b451aee99fef67afe45b..d2f59ab7c1d81158cceebf127d22df3376b616de 100644 (file)
--- 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;
 }