diff options
author | Garrett Wollman <wollman@FreeBSD.org> | 2018-05-23 02:54:28 +0000 |
---|---|---|
committer | Garrett Wollman <wollman@FreeBSD.org> | 2018-05-23 02:54:28 +0000 |
commit | 6cf21d56cab6833d85e3dd474937bd98693323bb (patch) | |
tree | f4b5872b0c44d3791cd0dd372be0199492945953 | |
parent | 0840e619bb18986a24a001f81c907f385bb2d3cf (diff) | |
download | src-6cf21d56cab6833d85e3dd474937bd98693323bb.tar.gz src-6cf21d56cab6833d85e3dd474937bd98693323bb.zip |
Whoops, forgot to add this file in r334070.
PR: 164049
Notes
Notes:
svn path=/head/; revision=334071
-rw-r--r-- | usr.bin/getconf/unsigned_limits.gperf | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/usr.bin/getconf/unsigned_limits.gperf b/usr.bin/getconf/unsigned_limits.gperf new file mode 100644 index 000000000000..119b30000e70 --- /dev/null +++ b/usr.bin/getconf/unsigned_limits.gperf @@ -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; +} |