annotate tests/test-freopen.c @ 12421:e8d2c6fc33ad

Use spaces for indentation, not tabs.
author Bruno Haible <bruno@clisp.org>
date Thu, 10 Dec 2009 20:28:30 +0100
parents 0be6f1ab456d
children 33ab12a7cea2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9303
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of opening a file stream.
9889
0be6f1ab456d Flush the standard error stream before aborting.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
2 Copyright (C) 2007-2008 Free Software Foundation, Inc.
9303
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9303
diff changeset
4 This program is free software: you can redistribute it and/or modify
9303
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9303
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9303
diff changeset
7 (at your option) any later version.
9303
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9303
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
9303
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2007. */
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <stdio.h>
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #include <stdlib.h>
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 #define ASSERT(expr) \
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
25 do \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
26 { \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
27 if (!(expr)) \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
28 { \
9303
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
30 fflush (stderr); \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
31 abort (); \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
32 } \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
33 } \
9303
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 while (0)
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 int
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 main ()
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 {
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 ASSERT (freopen ("/dev/null", "r", stdin) != NULL);
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 return 0;
136d24950879 Test for module 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 }