]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/vsscanf.c
ncurses 4.1
[ncurses.git] / ncurses / vsscanf.c
1 /*
2  * This function is needed to support vwscanw
3  */
4
5 #include <curses.priv.h>
6
7 #if !HAVE_VSSCANF
8
9 MODULE_ID("$Id: vsscanf.c,v 1.10 1996/12/21 14:24:06 tom Exp $")
10
11 #if defined(_IOREAD) && defined(_NFILE)
12 /*VARARGS2*/
13 int vsscanf(const char *str, const char *format, va_list ap)
14 {
15         /*
16          * This code should work on anything descended from AT&T SVr1.
17          */
18         FILE    strbuf;
19
20         strbuf._flag = _IOREAD;
21         strbuf._ptr = strbuf._base = (unsigned char*)str;
22         strbuf._cnt = strlen(str);
23         strbuf._file = _NFILE;
24
25 #if HAVE_VFSCANF
26         return(vfscanf(&strbuf, format, ap));
27 #else
28         return(_doscan(&strbuf, format, ap));
29 #endif
30 }
31 #else
32 /*VARARGS2*/
33 int vsscanf(const char *str, const char *format, va_list ap)
34 {
35         /*
36          * You don't have a native vsscanf(3), and you don't have System-V
37          * compatible stdio internals.  You're probably using a BSD
38          * older than 4.4 or a really old Linux.  You lose.  Upgrade
39          * to a current C library to win.
40          */
41         return -1;      /* not implemented */
42 }
43 #endif
44 #else
45 extern void _nc_vsscanf(void);  /* quiet's gcc warning */
46 void _nc_vsscanf(void) { } /* nonempty for strict ANSI compilers */
47 #endif /* !HAVE_VSSCANF */