summaryrefslogtreecommitdiff
path: root/posix/annexc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-29 22:42:30 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-29 22:42:30 +0000
commit999b2f6bd7c194dff96e323fffbbe59564bfc1ee (patch)
treed7b70093f07ff8458a02e92c6a72a7b15a8ec41b /posix/annexc.c
parentcf26217d2cabf23e09233f2ba9dbfd4138942868 (diff)
Update.
1998-09-29 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/ypclnt.c (yp_all): Close UDP socket und give CLIENT handle free. 1998-09-29 Cristian Gafton <gafton@redhat.com> * sysdeps/unix/sysv/linux/alpha/ioperm.c: List Ruffian in platforms[]. * sysdeps/unix/sysv/linux/net/if_shaper.h: New file. * sysdeps/unix/sysv/linux/Dist: Add net/if_shaper.h. * sysdeps/unix/sysv/linux/Makefile [subdirs=inet] (sysdep_headers): Add net/if_shaper.h. * libio/libio.h [!__STDC__]: Define const only if not defined.
Diffstat (limited to 'posix/annexc.c')
-rw-r--r--posix/annexc.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/posix/annexc.c b/posix/annexc.c
index 56af0a52b5..e9e1ac9cdd 100644
--- a/posix/annexc.c
+++ b/posix/annexc.c
@@ -22,6 +22,8 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <signal.h>
+#include <sys/wait.h>
#define TMPFILE "/tmp/macros"
#define HEADER_MAX 256
@@ -629,6 +631,7 @@ const char *INC;
static char *xstrndup (const char *, size_t);
static const char **get_null_defines (void);
static int check_header (const struct header *, const char **);
+static int xsystem (const char *);
int
main (int argc, char *argv[])
@@ -674,6 +677,31 @@ xstrndup (const char *s, size_t n)
}
+/* Like system but propagate interrupt and quit signals. */
+int
+xsystem (const char *cmd)
+{
+ int status;
+
+ status = system (cmd);
+ if (status != -1)
+ {
+ if (WIFSIGNALED (status))
+ {
+ if (WTERMSIG (status) == SIGINT || WTERMSIG (status) == SIGQUIT)
+ raise (WTERMSIG (status));
+ }
+ else if (WIFEXITED (status))
+ {
+ if (WEXITSTATUS (status) == SIGINT + 128
+ || WEXITSTATUS (status) == SIGQUIT + 128)
+ raise (WEXITSTATUS (status) - 128);
+ }
+ }
+ return status;
+}
+
+
static const char **
get_null_defines (void)
{
@@ -695,7 +723,7 @@ get_null_defines (void)
sprintf (command, fmt, "/dev/null", CC, INC, CC, TMPFILE);
- if (system (command))
+ if (xsystem (command))
{
puts ("system() returned nonzero");
return NULL;
@@ -787,14 +815,14 @@ check_header (const struct header *header, const char **except)
if (header->subset != NULL)
{
sprintf (line, testfmt, header->subset, CC, INC, CC, TMPFILE);
- if (system (line))
+ if (xsystem (line))
{
printf ("!! not available\n");
return 0;
}
}
- if (system (command))
+ if (xsystem (command))
{
puts ("system() returned nonzero");
result = 1;