2000-12-19 Mark Kettenis <kettenis@gnu.org>
[official-gcc.git] / libio / iovsscanf.c
blob6bdc3ccf01828503d8c48c3cf207e28003883d16
1 /* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU IO Library.
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2, or (at
7 your option) any later version.
9 This library is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this library; see the file COPYING. If not, write to
16 the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
17 MA 02111-1307, USA.
19 As a special exception, if you link this library with files
20 compiled with a GNU compiler to produce an executable, this does
21 not cause the resulting executable to be covered by the GNU General
22 Public License. This exception does not however invalidate any
23 other reasons why the executable file might be covered by the GNU
24 General Public License. */
26 #include "libioP.h"
27 #include "strfile.h"
29 int
30 _IO_vsscanf (string, format, args)
31 const char *string;
32 const char *format;
33 _IO_va_list args;
35 int ret;
36 _IO_strfile sf;
37 #ifdef _IO_MTSAFE_IO
38 _IO_lock_t lock;
39 sf._sbf._f._lock = &lock;
40 #endif
41 _IO_init (&sf._sbf._f, 0);
42 _IO_JUMPS (&sf._sbf._f) = &_IO_str_jumps;
43 _IO_str_init_static (&sf._sbf._f, (char*)string, 0, NULL);
44 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf);
45 _IO_flockfile (&sf._sbf._f);
46 ret = _IO_vfscanf (&sf._sbf._f, format, args, NULL);
47 _IO_cleanup_region_end (1);
48 return ret;
51 #ifdef weak_alias
52 weak_alias (_IO_vsscanf, __vsscanf)
53 weak_alias (_IO_vsscanf, vsscanf)
54 #elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL)
55 int __vsscanf (const char *, const char *, _IO_va_list)
56 __attribute__ ((weak, alias("_IO_vsscanf")));
57 int vsscanf (const char *, const char *, _IO_va_list)
58 __attribute__ ((weak, alias("_IO_vsscanf")));
59 #endif