maint: update copyright
[gnulib.git] / tests / test-posix_spawn1.c
index 80a91d1..86b8d94 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of posix_spawn() function.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2014 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <spawn.h>
 
+#include "signature.h"
+SIGNATURE_CHECK (posix_spawnp, int, (pid_t *, char const *,
+                                     posix_spawn_file_actions_t const *,
+                                     posix_spawnattr_t const *,
+                                     char *const[], char *const[]));
+SIGNATURE_CHECK (posix_spawnattr_init, int, (posix_spawnattr_t *));
+SIGNATURE_CHECK (posix_spawnattr_destroy, int, (posix_spawnattr_t *));
+SIGNATURE_CHECK (posix_spawnattr_setsigmask, int, (posix_spawnattr_t *,
+                                                   sigset_t const *));
+SIGNATURE_CHECK (posix_spawnattr_setflags, int, (posix_spawnattr_t *, short));
+SIGNATURE_CHECK (posix_spawn_file_actions_init, int,
+                 (posix_spawn_file_actions_t *));
+SIGNATURE_CHECK (posix_spawn_file_actions_destroy, int,
+                 (posix_spawn_file_actions_t *));
+SIGNATURE_CHECK (posix_spawn_file_actions_addclose, int,
+                 (posix_spawn_file_actions_t *, int));
+SIGNATURE_CHECK (posix_spawn_file_actions_addopen, int,
+                 (posix_spawn_file_actions_t *, int, char const *, int,
+                  mode_t));
+SIGNATURE_CHECK (posix_spawn_file_actions_adddup2, int,
+                 (posix_spawn_file_actions_t *, int, int));
+
 #include <errno.h>
 #include <fcntl.h>
 #include <signal.h>
 
 extern char **environ;
 
-#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-#endif
-#ifndef STDOUT_FILENO
-# define STDOUT_FILENO 1
-#endif
-#ifndef STDERR_FILENO
-# define STDERR_FILENO 2
-#endif
-
-#ifndef WTERMSIG
-# define WTERMSIG(x) ((x) & 0x7f)
-#endif
-#ifndef WCOREDUMP
-# define WCOREDUMP(x) ((x) & 0x80)
-#endif
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(x) (((x) >> 8) & 0xff)
-#endif
-#ifndef WIFSIGNALED
-# define WIFSIGNALED(x) (WTERMSIG (x) != 0 && WTERMSIG(x) != 0x7f)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(x) (WTERMSIG (x) == 0)
-#endif
-#ifndef WIFSTOPPED
-# define WIFSTOPPED(x) (WTERMSIG (x) == 0x7f)
-#endif
-
 #define CHILD_PROGRAM_FILENAME "test-posix_spawn1.sh"
 
 static int
@@ -77,12 +70,12 @@ fd_safer (int fd)
     }
 
   return fd;
-}  
+}
 
 int
 main ()
 {
-  char *argv[3] = { "/bin/sh", CHILD_PROGRAM_FILENAME, NULL };
+  char *argv[3] = { (char *) "/bin/sh", (char *) CHILD_PROGRAM_FILENAME, NULL };
   int ifd[2];
   sigset_t blocked_signals;
   sigset_t fatal_signal_set;
@@ -125,9 +118,9 @@ main ()
           || (err = posix_spawnp (&child, "/bin/sh", &actions, &attrs, argv, environ)) != 0))
     {
       if (actions_allocated)
-       posix_spawn_file_actions_destroy (&actions);
+        posix_spawn_file_actions_destroy (&actions);
       if (attrs_allocated)
-       posix_spawnattr_destroy (&attrs);
+        posix_spawnattr_destroy (&attrs);
       sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL);
       errno = err;
       perror ("subprocess failed");