/* * sscanf — форматированный разбор строки; ядро — _scanf_core, * источник — движущийся указатель по ASCIIZ-строке. */ #include #include "_scanf.h" static const char *ss_p; static int ss_get(void *ctx) { (void)ctx; if (!*ss_p) return -1; return (unsigned char)*ss_p++; } static void ss_unget(void *ctx, int c) { (void)ctx; (void)c; ss_p--; } int sscanf(const char *s, const char *fmt, ...) { ss_p = s; va_list ap; va_start(ap, fmt); int r = _scanf_core(ss_get, ss_unget, 0, fmt, ap); va_end(ap); return r; }