1 /* $NetBSD: scheck.c,v 1.7 2009/12/31 22:49:16 mlelstv 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.7 2009/12/31 22:49:16 mlelstv Exp $");
20 #endif /* !defined lint */
27 scheck(string
, format
)
28 const char * const string
;
29 const char * const format
;
32 register const char * fp
;
35 register const char * result
;
39 if (string
== NULL
|| format
== NULL
)
41 fbuf
= imalloc((int) (2 * strlen(format
) + 4));
46 while ((*tp
++ = c
= *fp
++) != '\0') {
58 if (*fp
== 'l' || *fp
== 'h')
62 while (*fp
!= '\0' && *fp
!= ']');
63 if ((*tp
++ = *fp
++) == '\0')
69 if (sscanf(string
, fbuf
, &dummy
) != 1)
70 result
= (char *) format
;