diff options
author | Bruno Haible <bruno@clisp.org> | 2007-10-07 04:46:57 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2007-10-07 04:46:57 +0200 |
commit | 86f87b4967587bcac4fae90ee86c6fce24e3a4f3 (patch) | |
tree | 8f5b7b203e64b52cf531e5b7bf08ddbf1ae19ce3 /lib/fopen.c | |
parent | 77676a2d625501ec06a3c1dfb6f6db0c858b8b8c (diff) | |
download | gnulib-86f87b4967587bcac4fae90ee86c6fce24e3a4f3.tar.gz |
New modules 'fopen' and 'freopen'.
Diffstat (limited to 'lib/fopen.c')
-rw-r--r-- | lib/fopen.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/fopen.c b/lib/fopen.c new file mode 100644 index 0000000000..2faad59027 --- /dev/null +++ b/lib/fopen.c @@ -0,0 +1,37 @@ +/* Open a stream to a file. + Copyright (C) 2007 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ + +#include <config.h> + +/* Specification. */ +#include <stdio.h> + +#include <string.h> + +FILE * +fopen (const char *filename, const char *mode) +#undef fopen +{ +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + if (strcmp (filename, "/dev/null") == 0) + filename = "NUL"; +#endif + + return fopen (filename, mode); +} |