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

Last change on this file since 6262b5c 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
10extern int16_t agetc(FILE *ptr);
11extern int16_t scanfmt(int16_t (*getsub)(), int8_t *fmt, int16_t **args);
12
13static int16_t scnlast;
14static FILE *scnfp;
15
16static 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
30int16_t scanf(int8_t *fmt, int16_t *args)
31{
32 scnfp = stdin;
33 scnlast = 0;
34 return(scanfmt(gchar, fmt, &args));
35}
36
37int16_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.