diff options
author | tedu <tedu@openbsd.org> | 2015-02-10 05:44:50 +0000 |
---|---|---|
committer | tedu <tedu@openbsd.org> | 2015-02-10 05:44:50 +0000 |
commit | 6d42e4cdd927358a974ad628b072c72185ba23bc (patch) | |
tree | 8593af75eb8102ee02f026ec3f51025f007bf7ca /usr.sbin/zic | |
parent | Expand the IMPLEMENT_ASN1_ALLOC_FUNCTIONS macro so that the code is visible (diff) | |
download | wireguard-openbsd-6d42e4cdd927358a974ad628b072c72185ba23bc.tar.xz wireguard-openbsd-6d42e4cdd927358a974ad628b072c72185ba23bc.zip |
move scheck.c into zic.c
Diffstat (limited to 'usr.sbin/zic')
-rw-r--r-- | usr.sbin/zic/Makefile | 4 | ||||
-rw-r--r-- | usr.sbin/zic/scheck.c | 58 | ||||
-rw-r--r-- | usr.sbin/zic/zic.c | 50 |
3 files changed, 51 insertions, 61 deletions
diff --git a/usr.sbin/zic/Makefile b/usr.sbin/zic/Makefile index 3b881e3c521..475ef6e6fec 100644 --- a/usr.sbin/zic/Makefile +++ b/usr.sbin/zic/Makefile @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile,v 1.5 2015/02/09 13:04:58 tedu Exp $ +# $OpenBSD: Makefile,v 1.6 2015/02/10 05:44:50 tedu Exp $ PROG= zic -SRCS= zic.c scheck.c +SRCS= zic.c MAN= zic.8 CFLAGS+=-I${.CURDIR}/../../lib/libc/time -Wall diff --git a/usr.sbin/zic/scheck.c b/usr.sbin/zic/scheck.c deleted file mode 100644 index ffe969e6fd3..00000000000 --- a/usr.sbin/zic/scheck.c +++ /dev/null @@ -1,58 +0,0 @@ -/* $OpenBSD: scheck.c,v 1.3 2015/02/09 14:42:44 tedu Exp $ */ -/* -** This file is in the public domain, so clarified as of -** 2006-07-17 by Arthur David Olson. -*/ - -#include <ctype.h> - -#include "private.h" - -const char * -scheck(string, format) -const char * const string; -const char * const format; -{ - char * fbuf; - const char * fp; - char * tp; - int c; - const char * result; - char dummy; - - result = ""; - if (string == NULL || format == NULL) - return result; - fbuf = malloc(2 * strlen(format) + 4); - if (fbuf == NULL) - return result; - fp = format; - tp = fbuf; - while ((*tp++ = c = *fp++) != '\0') { - if (c != '%') - continue; - if (*fp == '%') { - *tp++ = *fp++; - continue; - } - *tp++ = '*'; - if (*fp == '*') - ++fp; - while (isdigit((unsigned char)*fp)) - *tp++ = *fp++; - if (*fp == 'l' || *fp == 'h') - *tp++ = *fp++; - else if (*fp == '[') - do *tp++ = *fp++; - while (*fp != '\0' && *fp != ']'); - if ((*tp++ = *fp++) == '\0') - break; - } - *(tp - 1) = '%'; - *tp++ = 'c'; - *tp = '\0'; - if (sscanf(string, fbuf, &dummy) != 1) - result = format; - free(fbuf); - return result; -} diff --git a/usr.sbin/zic/zic.c b/usr.sbin/zic/zic.c index a06e36dfd04..ec034cd55c9 100644 --- a/usr.sbin/zic/zic.c +++ b/usr.sbin/zic/zic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zic.c,v 1.13 2015/02/10 03:35:46 tedu Exp $ */ +/* $OpenBSD: zic.c,v 1.14 2015/02/10 05:44:50 tedu Exp $ */ /* ** This file is in the public domain, so clarified as of ** 2006-07-17 by Arthur David Olson. @@ -430,6 +430,54 @@ warning(const char *string) --errors; } + +static const char * +scheck(const char *string, const char *format) +{ + char * fbuf; + const char * fp; + char * tp; + int c; + const char * result; + char dummy; + + result = ""; + if (string == NULL || format == NULL) + return result; + fbuf = malloc(2 * strlen(format) + 4); + if (fbuf == NULL) + return result; + fp = format; + tp = fbuf; + while ((*tp++ = c = *fp++) != '\0') { + if (c != '%') + continue; + if (*fp == '%') { + *tp++ = *fp++; + continue; + } + *tp++ = '*'; + if (*fp == '*') + ++fp; + while (isdigit((unsigned char)*fp)) + *tp++ = *fp++; + if (*fp == 'l' || *fp == 'h') + *tp++ = *fp++; + else if (*fp == '[') + do *tp++ = *fp++; + while (*fp != '\0' && *fp != ']'); + if ((*tp++ = *fp++) == '\0') + break; + } + *(tp - 1) = '%'; + *tp++ = 'c'; + *tp = '\0'; + if (sscanf(string, fbuf, &dummy) != 1) + result = format; + free(fbuf); + return result; +} + static void usage(void) { |