xref: /freebsd/usr.bin/getconf/confstr.gperf (revision e9cfb9ae3ade961f80124f3cca73e8e9dae2315b)
18c6bd995SGarrett Wollman%{
28c6bd995SGarrett Wollman/*
38c6bd995SGarrett Wollman * Copyright is disclaimed as to the contents of this file.
48c6bd995SGarrett Wollman *
58c6bd995SGarrett Wollman * $FreeBSD$
68c6bd995SGarrett Wollman */
78c6bd995SGarrett Wollman
88c6bd995SGarrett Wollman#include <sys/types.h>
98c6bd995SGarrett Wollman
108c6bd995SGarrett Wollman#include <string.h>
118c6bd995SGarrett Wollman#include <unistd.h>
128c6bd995SGarrett Wollman
138c6bd995SGarrett Wollman#include "getconf.h"
148c6bd995SGarrett Wollman
158c6bd995SGarrett Wollman/*
168c6bd995SGarrett Wollman * Override gperf's built-in external scope.
178c6bd995SGarrett Wollman */
188c6bd995SGarrett Wollmanstatic const struct map *in_word_set(const char *str, unsigned int len);
198c6bd995SGarrett Wollman
20e9cfb9aeSGarrett Wollman/*
21e9cfb9aeSGarrett Wollman * The Standard seems a bit ambiguous over whether the POSIX_V6_*
22e9cfb9aeSGarrett Wollman * are specified with or without a leading underscore, so we just
23e9cfb9aeSGarrett Wollman * use both.
24e9cfb9aeSGarrett Wollman */
258c6bd995SGarrett Wollman%}
26e9cfb9aeSGarrett Wollmanstruct map { const char *name; int key; int valid; };
278c6bd995SGarrett Wollman%%
288c6bd995SGarrett WollmanPATH, _CS_PATH
2955a7bf6bSGarrett WollmanPOSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS
3055a7bf6bSGarrett WollmanPOSIX_V6_ILP32_OFF32_LDFLAGS, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
3155a7bf6bSGarrett WollmanPOSIX_V6_ILP32_OFF32_LIBS, _CS_POSIX_V6_ILP32_OFF32_LIBS
3255a7bf6bSGarrett WollmanPOSIX_V6_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
3355a7bf6bSGarrett WollmanPOSIX_V6_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
3455a7bf6bSGarrett WollmanPOSIX_V6_ILP32_OFFBIG_LIBS, _CS_POSIX_V6_ILP32_OFFBIG_LIBS
3555a7bf6bSGarrett WollmanPOSIX_V6_LP64_OFF64_CFLAGS, _CS_POSIX_V6_LP64_OFF64_CFLAGS
3655a7bf6bSGarrett WollmanPOSIX_V6_LP64_OFF64_LDFLAGS, _CS_POSIX_V6_LP64_OFF64_LDFLAGS
3755a7bf6bSGarrett WollmanPOSIX_V6_LP64_OFF64_LIBS, _CS_POSIX_V6_LP64_OFF64_LIBS
3855a7bf6bSGarrett WollmanPOSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
3955a7bf6bSGarrett WollmanPOSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
4055a7bf6bSGarrett WollmanPOSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
4155a7bf6bSGarrett WollmanPOSIX_V6_WIDTH_RESTRICTED_ENVS, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
42e9cfb9aeSGarrett Wollman_POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS
43e9cfb9aeSGarrett Wollman_POSIX_V6_ILP32_OFF32_LDFLAGS, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
44e9cfb9aeSGarrett Wollman_POSIX_V6_ILP32_OFF32_LIBS, _CS_POSIX_V6_ILP32_OFF32_LIBS
45e9cfb9aeSGarrett Wollman_POSIX_V6_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
46e9cfb9aeSGarrett Wollman_POSIX_V6_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
47e9cfb9aeSGarrett Wollman_POSIX_V6_ILP32_OFFBIG_LIBS, _CS_POSIX_V6_ILP32_OFFBIG_LIBS
48e9cfb9aeSGarrett Wollman_POSIX_V6_LP64_OFF64_CFLAGS, _CS_POSIX_V6_LP64_OFF64_CFLAGS
49e9cfb9aeSGarrett Wollman_POSIX_V6_LP64_OFF64_LDFLAGS, _CS_POSIX_V6_LP64_OFF64_LDFLAGS
50e9cfb9aeSGarrett Wollman_POSIX_V6_LP64_OFF64_LIBS, _CS_POSIX_V6_LP64_OFF64_LIBS
51e9cfb9aeSGarrett Wollman_POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
52e9cfb9aeSGarrett Wollman_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
53e9cfb9aeSGarrett Wollman_POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
54e9cfb9aeSGarrett Wollman_POSIX_V6_WIDTH_RESTRICTED_ENVS, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
558c6bd995SGarrett Wollman%%
568c6bd995SGarrett Wollmanint
57e9cfb9aeSGarrett Wollmanfind_confstr(const char *name, int *key)
588c6bd995SGarrett Wollman{
598c6bd995SGarrett Wollman	const struct map *rv;
608c6bd995SGarrett Wollman
618c6bd995SGarrett Wollman	rv = in_word_set(name, strlen(name));
62e9cfb9aeSGarrett Wollman	if (rv != NULL) {
63e9cfb9aeSGarrett Wollman		if (rv->valid) {
64e9cfb9aeSGarrett Wollman			*key = rv->key;
65e9cfb9aeSGarrett Wollman			return 1;
66e9cfb9aeSGarrett Wollman		}
678c6bd995SGarrett Wollman		return -1;
688c6bd995SGarrett Wollman	}
69e9cfb9aeSGarrett Wollman	return 0;
70e9cfb9aeSGarrett Wollman}
71