summaryrefslogtreecommitdiff
path: root/tests/tio_str.c
diff options
context:
space:
mode:
authorAndreas Enge <andreas.enge@inria.fr>2011-08-22 13:32:20 +0000
committerAndreas Enge <andreas.enge@inria.fr>2011-08-22 13:32:20 +0000
commit45412d5f96a7d6a779a3f18641ea83e99986826f (patch)
tree384f8cbd229ed5b59146194347f9ca0cabcfd6f9 /tests/tio_str.c
parent8c7c394208687e1497285e29b5cc11c222dec954 (diff)
downloadmpc-git-45412d5f96a7d6a779a3f18641ea83e99986826f.tar.gz
tio_str.c: replace fileno(stdin/out)) by STDIN/OUT_FILENO
configure.ac: remove test for fileno git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/mpc/trunk@1022 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tio_str.c')
-rw-r--r--tests/tio_str.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/tio_str.c b/tests/tio_str.c
index d5d0f68..9b46d0f 100644
--- a/tests/tio_str.c
+++ b/tests/tio_str.c
@@ -19,7 +19,6 @@ along with the MPC Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-#define _XOPEN_SOURCE 600 /* for fileno */
#include <stdio.h>
#include <string.h>
@@ -27,6 +26,9 @@ MA 02111-1307, USA. */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#else
+#define STDIN_FILENO 1
+#define STDOUT_FILENO 1
#endif
extern unsigned long line_number;
@@ -165,7 +167,7 @@ check_stdout (mpc_ptr read_number, mpc_ptr expected)
size_t sz;
fflush(stdout);
- fd = dup(fileno(stdout));
+ fd = dup(STDOUT_FILENO);
if (freopen(tmp_file, "w", stdout) == NULL)
{
printf ("mpc_inp_str cannot redirect stdout\n");
@@ -173,12 +175,12 @@ check_stdout (mpc_ptr read_number, mpc_ptr expected)
}
mpc_out_str (NULL, 2, 0, expected, MPC_RNDNN);
fflush(stdout);
- dup2(fd, fileno(stdout));
+ dup2(fd, STDOUT_FILENO);
close(fd);
clearerr(stdout);
fflush(stdin);
- fd = dup(fileno(stdin));
+ fd = dup(STDIN_FILENO);
if (freopen(tmp_file, "r", stdin) == NULL)
{
printf ("mpc_inp_str cannot redirect stdout\n");
@@ -201,7 +203,7 @@ check_stdout (mpc_ptr read_number, mpc_ptr expected)
exit (1);
}
fflush(stdin);
- dup2(fd, fileno(stdin));
+ dup2(fd, STDIN_FILENO);
close(fd);
clearerr(stdin);
}