X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Ftest-binary-io.c;h=b258d51ab05a9a2fd849e2937139facb84fc7cc2;hb=931b01b091932a1f796c23379ea32abb68bd5895;hp=8e5d193f69dfe527f765526d7cdb4883f085cd24;hpb=7be93f2d05131d061bd4790ae33c8d50f50010d7;p=platform%2Fupstream%2Fm4.git diff --git a/tests/test-binary-io.c b/tests/test-binary-io.c index 8e5d193..b258d51 100644 --- a/tests/test-binary-io.c +++ b/tests/test-binary-io.c @@ -1,5 +1,5 @@ /* Test of binary mode I/O. - Copyright (C) 2005, 2007-2011 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2013 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 @@ -30,35 +30,40 @@ #include "macros.h" int -main () +main (int argc, char *argv[]) { /* Test the O_BINARY macro. */ { int fd = - open ("t-bin-out2.tmp", O_CREAT | O_TRUNC | O_RDWR | O_BINARY, 0600); + open ("t-bin-out0.tmp", O_CREAT | O_TRUNC | O_RDWR | O_BINARY, 0600); if (write (fd, "Hello\n", 6) < 0) exit (1); close (fd); } { struct stat statbuf; - if (stat ("t-bin-out2.tmp", &statbuf) < 0) + if (stat ("t-bin-out0.tmp", &statbuf) < 0) exit (1); ASSERT (statbuf.st_size == 6); } - unlink ("t-bin-out2.tmp"); - /* Test the SET_BINARY macro. */ - SET_BINARY (1); - fputs ("Hello\n", stdout); - fclose (stdout); - fclose (stderr); - { - struct stat statbuf; - if (stat ("t-bin-out1.tmp", &statbuf) < 0) - exit (1); - ASSERT (statbuf.st_size == 6); - } + switch (argv[1][0]) + { + case '1': + /* Test the set_binary_mode() function. */ + set_binary_mode (1, O_BINARY); + fputs ("Hello\n", stdout); + break; + + case '2': + /* Test the SET_BINARY macro. */ + SET_BINARY (1); + fputs ("Hello\n", stdout); + break; + + default: + break; + } return 0; }