OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [stdio/] [viscanf.c] - Blame information for rev 326

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/*-
2
 * Code created by modifying iscanf.c which has following copyright.
3
 *
4
 * Copyright (c) 1990 The Regents of the University of California.
5
 * All rights reserved.
6
 *
7
 * Redistribution and use in source and binary forms are permitted
8
 * provided that the above copyright notice and this paragraph are
9
 * duplicated in all such forms and that any documentation,
10
 * advertising materials, and other materials related to such
11
 * distribution and use acknowledge that the software was developed
12
 * by the University of California, Berkeley.  The name of the
13
 * University may not be used to endorse or promote products derived
14
 * from this software without specific prior written permission.
15
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18
 */
19
 
20
/*
21
FUNCTION
22
<<viscanf>>, <<vfiscanf>>, <<vsiscanf>>---format argument list
23
 
24
INDEX
25
        viscanf
26
INDEX
27
        _viscanf_r
28
INDEX
29
        vfiscanf
30
INDEX
31
        _vfiscanf_r
32
INDEX
33
        vsiscanf
34
INDEX
35
        _vsiscanf_r
36
 
37
ANSI_SYNOPSIS
38
        #include <stdio.h>
39
        #include <stdarg.h>
40
        int viscanf(const char *<[fmt]>, va_list <[list]>);
41
        int vfiscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
42
        int vsiscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>);
43
 
44
        int _viscanf_r(struct _reent *<[reent]>, const char *<[fmt]>,
45
                       va_list <[list]>);
46
        int _vfiscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
47
                       va_list <[list]>);
48
        int _vsiscanf_r(struct _reent *<[reent]>, const char *<[str]>,
49
                       const char *<[fmt]>, va_list <[list]>);
50
 
51
TRAD_SYNOPSIS
52
        #include <stdio.h>
53
        #include <varargs.h>
54
        int viscanf( <[fmt]>, <[ist]>)
55
        char *<[fmt]>;
56
        va_list <[list]>;
57
 
58
        int vfiscanf( <[fp]>, <[fmt]>, <[list]>)
59
        FILE *<[fp]>;
60
        char *<[fmt]>;
61
        va_list <[list]>;
62
 
63
        int vsiscanf( <[str]>, <[fmt]>, <[list]>)
64
        char *<[str]>;
65
        char *<[fmt]>;
66
        va_list <[list]>;
67
 
68
        int _viscanf_r( <[reent]>, <[fmt]>, <[ist]>)
69
        struct _reent *<[reent]>;
70
        char *<[fmt]>;
71
        va_list <[list]>;
72
 
73
        int _vfiscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>)
74
        struct _reent *<[reent]>;
75
        FILE *<[fp]>;
76
        char *<[fmt]>;
77
        va_list <[list]>;
78
 
79
        int _vsiscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>)
80
        struct _reent *<[reent]>;
81
        char *<[str]>;
82
        char *<[fmt]>;
83
        va_list <[list]>;
84
 
85
DESCRIPTION
86
<<viscanf>>, <<vfiscanf>>, and <<vsiscanf>> are (respectively) variants
87
of <<iscanf>>, <<fiscanf>>, and <<siscanf>>.  They differ only in
88
allowing their caller to pass the variable argument list as a
89
<<va_list>> object (initialized by <<va_start>>) rather than
90
directly accepting a variable number of arguments.
91
 
92
RETURNS
93
The return values are consistent with the corresponding functions:
94
<<viscanf>> returns the number of input fields successfully scanned,
95
converted, and stored; the return value does not include scanned
96
fields which were not stored.
97
 
98
If <<viscanf>> attempts to read at end-of-file, the return value
99
is <<EOF>>.
100
 
101
If no fields were stored, the return value is <<0>>.
102
 
103
The routines <<_viscanf_r>>, <<_vfiscanf_f>>, and <<_vsiscanf_r>> are
104
reentrant versions which take an additional first parameter which points to the
105
reentrancy structure.
106
 
107
PORTABILITY
108
These are newlib extensions.
109
 
110
Supporting OS subroutines required:
111
*/
112
 
113
#include <_ansi.h>
114
#include <reent.h>
115
#include <stdio.h>
116
#ifdef _HAVE_STDC
117
#include <stdarg.h>
118
#else
119
#include <varargs.h>
120
#endif
121
#include "local.h"
122
 
123
#ifndef _REENT_ONLY
124
 
125
int
126
_DEFUN(viscanf, (fmt, ap),
127
       _CONST char *fmt _AND
128
       va_list ap)
129
{
130
  _REENT_SMALL_CHECK_INIT (_REENT);
131
  return __svfiscanf_r (_REENT, _stdin_r (_REENT), fmt, ap);
132
}
133
 
134
#endif /* !_REENT_ONLY */
135
 
136
int
137
_DEFUN(_viscanf_r, (ptr, fmt, ap),
138
       struct _reent *ptr _AND
139
       _CONST char *fmt   _AND
140
       va_list ap)
141
{
142
  _REENT_SMALL_CHECK_INIT (ptr);
143
  return __svfiscanf_r (ptr, _stdin_r (ptr), fmt, ap);
144
}
145
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.