home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * SSCANF.C
- *
- * (c)Copyright 1990, Matthew Dillon, All Rights Reserved
- */
-
- #include <stdarg.h>
- #include <stdio.h>
-
- static int
- _sgetc(sst)
- unsigned char **sst;
- {
- unsigned char *ptr = *sst;
- if (*ptr) {
- *sst = ptr + 1;
- return(*ptr);
- }
- return(EOF);
- }
-
- static void
- _sungetc(c, sst)
- short c;
- unsigned char **sst;
- {
- --*sst;
- }
-
- int
- sscanf(buf, ctl)
- char *buf;
- const char *ctl;
- {
- char *ptr = buf;
- int error;
- int cnt;
- va_list va;
-
- va_start(va, ctl);
- error = _sfmt(ctl, va, _sgetc, _sungetc, &ptr, &cnt);
- va_end(va);
- if (error)
- return(error);
- return(cnt);
- }
-
-