* sysdeps/i386/bits/byteswap.h (__bswap_32): Add __amdfam10__
[glibc/history.git] / libio / oldiofopen.c
blobc761580a784dae7753b439f7c22db1f220778ab3
1 /* Copyright (C) 1993,1997,1999,2000,2002,2003,2004
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA.
20 As a special exception, if you link the code in this file with
21 files compiled with a GNU compiler to produce an executable,
22 that does not cause the resulting executable to be covered by
23 the GNU Lesser General Public License. This exception does not
24 however invalidate any other reasons why the executable file
25 might be covered by the GNU Lesser General Public License.
26 This exception applies to code released by its copyright holders
27 in files containing the exception. */
29 #include <shlib-compat.h>
30 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
32 #define _IO_USE_OLD_IO_FILE
33 #include "libioP.h"
34 #ifdef __STDC__
35 #include <stdlib.h>
36 #endif
39 _IO_FILE *
40 attribute_compat_text_section
41 _IO_old_fopen (filename, mode)
42 const char *filename;
43 const char *mode;
45 struct locked_FILE
47 struct _IO_FILE_complete_plus fp;
48 #ifdef _IO_MTSAFE_IO
49 _IO_lock_t lock;
50 #endif
51 } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
53 if (new_f == NULL)
54 return NULL;
55 #ifdef _IO_MTSAFE_IO
56 new_f->fp.file._file._lock = &new_f->lock;
57 #endif
58 _IO_old_init (&new_f->fp.file._file, 0);
59 _IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fp) = &_IO_old_file_jumps;
60 _IO_old_file_init ((struct _IO_FILE_plus *) &new_f->fp);
61 #if !_IO_UNIFIED_JUMPTABLES
62 new_f->fp.vtable = NULL;
63 #endif
64 if (_IO_old_file_fopen ((_IO_FILE *) &new_f->fp, filename, mode) != NULL)
65 return (_IO_FILE *) &new_f->fp;
66 INTUSE(_IO_un_link) ((struct _IO_FILE_plus *) &new_f->fp);
67 free (new_f);
68 return NULL;
71 strong_alias (_IO_old_fopen, __old_fopen)
72 compat_symbol (libc, _IO_old_fopen, _IO_fopen, GLIBC_2_0);
73 compat_symbol (libc, __old_fopen, fopen, GLIBC_2_0);
74 #endif