Last change
on this file since 9519422 was 7258c6a, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Use standard integer types.
|
-
Property mode
set to
100644
|
File size:
800 bytes
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | fscanf.c -- scan a stream file for input for the portable C I/O Library
|
---|
4 | Version 4 -- 1989-01-16 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stdio.h"
|
---|
9 | #include "stddefs.h"
|
---|
10 |
|
---|
11 | static int16_t scnlast;
|
---|
12 | static FILE *scnfp;
|
---|
13 |
|
---|
14 | static int16_t gchar(int16_t what)
|
---|
15 | {
|
---|
16 | if (what EQ 0) {
|
---|
17 |
|
---|
18 | if (feof(scnfp))
|
---|
19 | scnlast = EOF;
|
---|
20 | else
|
---|
21 | scnlast = agetc(scnfp);
|
---|
22 | } else
|
---|
23 | scnlast = ungetc(scnlast, scnfp);
|
---|
24 |
|
---|
25 | return(scnlast);
|
---|
26 | }
|
---|
27 |
|
---|
28 | int16_t scanf(int8_t *fmt, int16_t *args)
|
---|
29 | {
|
---|
30 | scnfp = stdin;
|
---|
31 | scnlast = 0;
|
---|
32 | return(scanfmt(gchar, fmt, &args));
|
---|
33 | }
|
---|
34 |
|
---|
35 | int16_t fscanf(FILE *fp, int8_t *fmt, int16_t *args)
|
---|
36 | {
|
---|
37 | scnfp = fp;
|
---|
38 | scnlast = 0;
|
---|
39 | return(scanfmt(gchar, fmt, &args));
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.