diff options
author | zimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-08-30 09:35:38 +0000 |
---|---|---|
committer | zimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-08-30 09:35:38 +0000 |
commit | 5797bfd98bfa006264dcc66274996532a68a4472 (patch) | |
tree | ac7e4e2767e69abd7dc13f7edc4a43841443ea73 /tests/tio_str.c | |
parent | 6bb1fe09c2dccb342d497c628374cae76aa66125 (diff) | |
download | mpc-5797bfd98bfa006264dcc66274996532a68a4472.tar.gz |
[tio_str.c] try to get rid of string.h (problem with unistd.h on x86_64-darwin)
gnu style
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1032 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tio_str.c')
-rw-r--r-- | tests/tio_str.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/tests/tio_str.c b/tests/tio_str.c index f3e6c6c..d0f80ca 100644 --- a/tests/tio_str.c +++ b/tests/tio_str.c @@ -19,12 +19,11 @@ along with this program. If not, see http://www.gnu.org/licenses/ . */ #include <stdio.h> -#include <string.h> #include "mpc-tests.h" #ifdef HAVE_UNISTD_H -#include <unistd.h> +#include <unistd.h> /* for dup, dup2, STDIN_FILENO and STDOUT_FILENO */ #else #define STDIN_FILENO 0 #define STDOUT_FILENO 1 @@ -165,22 +164,22 @@ check_stdout (mpc_ptr read_number, mpc_ptr expected) int fd; size_t sz; - fflush(stdout); - fd = dup(STDOUT_FILENO); - if (freopen(tmp_file, "w", stdout) == NULL) + fflush (stdout); + fd = dup (STDOUT_FILENO); + if (freopen (tmp_file, "w", stdout) == NULL) { printf ("mpc_inp_str cannot redirect stdout\n"); exit (1); } mpc_out_str (NULL, 2, 0, expected, MPC_RNDNN); - fflush(stdout); - dup2(fd, STDOUT_FILENO); - close(fd); - clearerr(stdout); - - fflush(stdin); - fd = dup(STDIN_FILENO); - if (freopen(tmp_file, "r", stdin) == NULL) + fflush (stdout); + dup2 (fd, STDOUT_FILENO); + close (fd); + clearerr (stdout); + + fflush (stdin); + fd = dup (STDIN_FILENO); + if (freopen (tmp_file, "r", stdin) == NULL) { printf ("mpc_inp_str cannot redirect stdout\n"); exit (1); @@ -201,10 +200,10 @@ check_stdout (mpc_ptr read_number, mpc_ptr expected) MPC_OUT (expected); exit (1); } - fflush(stdin); - dup2(fd, STDIN_FILENO); - close(fd); - clearerr(stdin); + fflush (stdin); + dup2 (fd, STDIN_FILENO); + close (fd); + clearerr (stdin); } #endif /* MPC_NO_STREAM_REDIRECTION */ |