Date: Wed, 23 May 2018 02:54:28 +0000 (UTC) From: Garrett Wollman <wollman@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334071 - head/usr.bin/getconf Message-ID: <201805230254.w4N2sSba020344@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: wollman Date: Wed May 23 02:54:28 2018 New Revision: 334071 URL: https://svnweb.freebsd.org/changeset/base/334071 Log: Whoops, forgot to add this file in r334070. PR: 164049 Added: head/usr.bin/getconf/unsigned_limits.gperf (contents, props changed) Added: head/usr.bin/getconf/unsigned_limits.gperf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/getconf/unsigned_limits.gperf Wed May 23 02:54:28 2018 (r334071) @@ -0,0 +1,43 @@ +%{ +/* + * Copyright is disclaimed as to the contents of this file. + * + * $FreeBSD$ + */ + +#include <sys/types.h> + +#include <string.h> +#include <limits.h> + +#include "getconf.h" + +/* + * Override gperf's built-in external scope. + */ +static const struct map *in_word_set(const char *str); + +%} +struct map { const char *name; uintmax_t value; int valid; }; +%% +UCHAR_MAX, UCHAR_MAX +UINT_MAX, UINT_MAX +ULLONG_MAX, ULLONG_MAX +ULONG_MAX, ULONG_MAX +USHRT_MAX, USHRT_MAX +%% +int +find_unsigned_limit(const char *name, uintmax_t *value) +{ + const struct map *rv; + + rv = in_word_set(name); + if (rv != NULL) { + if (rv->valid) { + *value = rv->value; + return 1; + } + return -1; + } + return 0; +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805230254.w4N2sSba020344>