Last change
on this file since 0170798 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
839 bytes
|
Rev | Line | |
---|
[3ae31e9] | 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 int scnlast;
|
---|
| 12 | static FILE *scnfp;
|
---|
| 13 |
|
---|
| 14 | static
|
---|
| 15 | int
|
---|
| 16 | gchar(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 | int
|
---|
| 31 | scanf(fmt, args)
|
---|
| 32 | char *fmt;
|
---|
| 33 | int *args;
|
---|
| 34 | {
|
---|
| 35 | scnfp = stdin;
|
---|
| 36 | scnlast = 0;
|
---|
| 37 | return(scanfmt(gchar, fmt, &args));
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | int
|
---|
| 41 | fscanf(fp, fmt, args)
|
---|
| 42 | FILE *fp;
|
---|
| 43 | char *fmt;
|
---|
| 44 | int *args;
|
---|
| 45 | {
|
---|
| 46 | scnfp = fp;
|
---|
| 47 | scnlast = 0;
|
---|
| 48 | return(scanfmt(gchar, fmt, &args));
|
---|
| 49 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.