1%{
2/*
3 * Copyright is disclaimed as to the contents of this file.
4 */
5
6#include <sys/types.h>
7
8#include <string.h>
9#include <limits.h>
10
11#include "getconf.h"
12
13/*
14 * Override gperf's built-in external scope.
15 */
16static const struct map *in_word_set(const char *str);
17
18%}
19struct map { const char *name; uintmax_t value; int valid; };
20%%
21UCHAR_MAX, UCHAR_MAX
22UINT_MAX, UINT_MAX
23ULLONG_MAX, ULLONG_MAX
24ULONG_MAX, ULONG_MAX
25USHRT_MAX, USHRT_MAX
26%%
27int
28find_unsigned_limit(const char *name, uintmax_t *value)
29{
30	const struct map *rv;
31
32	rv = in_word_set(name);
33	if (rv != NULL) {
34		if (rv->valid) {
35			*value = rv->value;
36			return 1;
37		}
38		return -1;
39	}
40	return 0;
41}
42