diff options
author | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-08-22 13:32:20 +0000 |
---|---|---|
committer | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-08-22 13:32:20 +0000 |
commit | 432d31c63f3066268d311836f6c8eac122b685d9 (patch) | |
tree | 384f8cbd229ed5b59146194347f9ca0cabcfd6f9 | |
parent | 5a04370b9b4ee537b8888653d68c9f9d7b7cf705 (diff) | |
download | mpc-432d31c63f3066268d311836f6c8eac122b685d9.tar.gz |
tio_str.c: replace fileno(stdin/out)) by STDIN/OUT_FILENO
configure.ac: remove test for fileno
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1022 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | tests/tio_str.c | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac index b325145..6548eb6 100644 --- a/configure.ac +++ b/configure.ac @@ -127,7 +127,7 @@ AC_TYPE_SIZE_T # Checks for libraries. AC_CHECK_FUNCS([gettimeofday localeconv setlocale]) -AC_CHECK_FUNCS([dup dup2 fileno],, +AC_CHECK_FUNCS([dup dup2],, [AC_DEFINE([NO_STREAM_REDIRECTION],1,[Do not check mpc_out_str on stdout])]) AC_CHECK_LIB([gmp], [__gmpz_init], 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); } |