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