source: buchla-68k/libcio/fscanf.c@ e225e77

Last change on this file since e225e77 was e225e77, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Added missing includes and declarations.

  • Property mode set to 100644
File size: 908 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
11extern int16_t agetc(FILE *ptr);
12extern int16_t scanfmt(int16_t (*getsub)(), int8_t *fmt, int16_t **args);
13
14static int16_t scnlast;
15static FILE *scnfp;
16
17static int16_t gchar(int16_t what)
18{
19 if (what EQ 0) {
20
21 if (feof(scnfp))
22 scnlast = EOF;
23 else
24 scnlast = agetc(scnfp);
25 } else
26 scnlast = ungetc(scnlast, scnfp);
27
28 return(scnlast);
29}
30
31int16_t scanf(int8_t *fmt, int16_t *args)
32{
33 scnfp = stdin;
34 scnlast = 0;
35 return(scanfmt(gchar, fmt, &args));
36}
37
38int16_t fscanf(FILE *fp, int8_t *fmt, int16_t *args)
39{
40 scnfp = fp;
41 scnlast = 0;
42 return(scanfmt(gchar, fmt, &args));
43}
Note: See TracBrowser for help on using the repository browser.