summaryrefslogtreecommitdiffstats
path: root/contrib/ncurses/ncurses/base/vsscanf.c
blob: 70d0517a6f0e556c3e9b869624f473ecdd3ef3fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * This function is needed to support vwscanw
 */

#include <curses.priv.h>

#if !HAVE_VSSCANF

MODULE_ID("$Id: vsscanf.c,v 1.12 2000/12/10 02:43:28 tom Exp $")

#if defined(_IOREAD) && defined(_NFILE)
/*VARARGS2*/
NCURSES_EXPORT(int)
vsscanf
(const char *str, const char *format, va_list ap)
{
    /*
     * This code should work on anything descended from AT&T SVr1.
     */
    FILE strbuf;

    strbuf._flag = _IOREAD;
    strbuf._ptr = strbuf._base = (unsigned char *) str;
    strbuf._cnt = strlen(str);
    strbuf._file = _NFILE;

#if HAVE_VFSCANF
    return (vfscanf(&strbuf, format, ap));
#else
    return (_doscan(&strbuf, format, ap));
#endif
}
#else
/*VARARGS2*/
NCURSES_EXPORT(int)
vsscanf
(const char *str, const char *format, va_list ap)
{
    /*
     * You don't have a native vsscanf(3), and you don't have System-V
     * compatible stdio internals.  You're probably using a BSD
     * older than 4.4 or a really old Linux.  You lose.  Upgrade
     * to a current C library to win.
     */
    return -1;			/* not implemented */
}
#endif
#else
extern
NCURSES_EXPORT(void)
_nc_vsscanf(void);		/* quiet's gcc warning */
NCURSES_EXPORT(void)
_nc_vsscanf(void)
{
}				/* nonempty for strict ANSI compilers */
#endif /* !HAVE_VSSCANF */
OpenPOWER on IntegriCloud