home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / libsrc~1.z / libsrc~1 / sscanf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-28  |  458 b   |  31 lines

  1. #define __SRC__               /* fake prototypes */
  2. #include <stdio.h>
  3. #include <ansi.h>
  4.  
  5. extern int _scanf();
  6.  
  7. static int sgetc(s)
  8.     unsigned char **s;
  9.     {
  10.     register unsigned char c;
  11.  
  12.     c = *(*s)++;
  13.     return((c == '\0') ? EOF : c);
  14.     }
  15.  
  16. static int sungetc(c, s)
  17.     int c;
  18.     unsigned char **s;
  19.     {
  20.     if(c == EOF)
  21.         c = '\0';
  22.     return(*--(*s) = c);
  23.     }
  24.  
  25. int sscanf(buf, fmt, arg)
  26.     _CONST char *buf, *fmt;
  27.     int arg;
  28.     {
  29.     return(_scanf(&buf, sgetc, sungetc, fmt, &arg));
  30.     }
  31.