Last change
on this file since 39a696b was 6262b5c, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Added include files for global functions and variables.
|
-
Property mode
set to
100644
|
File size:
886 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 "all.h"
|
---|
9 |
|
---|
10 | extern int16_t agetc(FILE *ptr);
|
---|
11 | extern int16_t scanfmt(int16_t (*getsub)(), int8_t *fmt, int16_t **args);
|
---|
12 |
|
---|
13 | static int16_t scnlast;
|
---|
14 | static FILE *scnfp;
|
---|
15 |
|
---|
16 | static int16_t gchar(int16_t what)
|
---|
17 | {
|
---|
18 | if (what EQ 0) {
|
---|
19 |
|
---|
20 | if (feof(scnfp))
|
---|
21 | scnlast = EOF;
|
---|
22 | else
|
---|
23 | scnlast = agetc(scnfp);
|
---|
24 | } else
|
---|
25 | scnlast = ungetc(scnlast, scnfp);
|
---|
26 |
|
---|
27 | return(scnlast);
|
---|
28 | }
|
---|
29 |
|
---|
30 | int16_t scanf(int8_t *fmt, int16_t *args)
|
---|
31 | {
|
---|
32 | scnfp = stdin;
|
---|
33 | scnlast = 0;
|
---|
34 | return(scanfmt(gchar, fmt, &args));
|
---|
35 | }
|
---|
36 |
|
---|
37 | int16_t fscanf(FILE *fp, int8_t *fmt, int16_t *args)
|
---|
38 | {
|
---|
39 | scnfp = fp;
|
---|
40 | scnlast = 0;
|
---|
41 | return(scanfmt(gchar, fmt, &args));
|
---|
42 | }
|
---|
43 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.