/* Subprocesses with pipes.
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ 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
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Paul Eggert <eggert@twinsun.com>
and Florian Krohm <florian@edamail.fishkill.ibm.com>. */
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include "subpipe.h"
#include <stdlib.h>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+#include <unistd.h>
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
# define STDOUT_FILENO 1
#endif
#if ! HAVE_DUP2 && ! defined dup2
-# if HAVE_FCNTL_H
-# include <fcntl.h>
-# endif
+# include <fcntl.h>
# define dup2(f, t) (close (t), fcntl (f, F_DUPFD, t))
#endif
#include "gettext.h"
#define _(Msgid) gettext (Msgid)
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later. */
+# if ! defined __GNUC__ || __GNUC__ < 2 || \
+(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
+# define __attribute__(Spec) /* empty */
+# endif
+#endif
+
+#ifndef ATTRIBUTE_UNUSED
+# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
/* Initialize this module. */
int child_fd[2];
pid_t pid;
- if (pipe (child_fd) != 0
- || (child_fd[0] = fd_safer (child_fd[0])) < 0
- || (fd[0] = fd_safer (child_fd[1])) < 0
- || pipe (pipe_fd) != 0
- || (fd[1] = fd_safer (pipe_fd[0])) < 0
- || (child_fd[1] = fd_safer (pipe_fd[1])) < 0)
+ if (pipe_safer (child_fd) != 0 || pipe_safer (pipe_fd) != 0)
error (EXIT_FAILURE, errno, "pipe");
+ fd[0] = child_fd[1];
+ fd[1] = pipe_fd[0];
+ child_fd[1] = pipe_fd[1];
pid = vfork ();
if (pid < 0)
}
#endif
}
+
+void
+end_of_output_subpipe (pid_t pid ATTRIBUTE_UNUSED,
+ int fd[2] ATTRIBUTE_UNUSED)
+{
+}