1 /* $NetBSD: scheck.c,v 1.11 2013/07/17 23:09:26 christos Exp $ */
4 ** This file is in the public domain, so clarified as of
5 ** 2006-07-17 by Arthur David Olson.
8 #if HAVE_NBTOOL_CONFIG_H
9 #include "nbtool_config.h"
12 #include <sys/cdefs.h>
16 static char elsieid
[] = "@(#)scheck.c 8.19";
18 __RCSID("$NetBSD: scheck.c,v 1.11 2013/07/17 23:09:26 christos Exp $");
20 #endif /* !defined lint */
27 scheck(const char *const string
, const char *const format
)
37 if (string
== NULL
|| format
== NULL
)
39 fbuf
= malloc(2 * strlen(format
) + 4);
46 ** Copy directives, suppressing each conversion that is not
47 ** already suppressed. Scansets containing '%' are not
48 ** supported; e.g., the conversion specification "%[%]" is not
49 ** supported. Also, multibyte characters containing a
50 ** non-leading '%' byte are not supported.
52 while ((*tp
++ = c
= *fp
++) != '\0') {
60 } while (is_digit(c
));
69 if ((*tp
++ = *fp
++) == '\0')
76 if (sscanf(string
, fbuf
, &dummy
) != 1)