From 5fd83771641d15c418f747bd343ba6738d3875f7 Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Sun, 9 May 2021 14:20:58 -0400 Subject: Import macOS userland adv_cmds-176 basic_cmds-55 bootstrap_cmds-116.100.1 developer_cmds-66 diskdev_cmds-667.40.1 doc_cmds-53.60.1 file_cmds-321.40.3 mail_cmds-35 misc_cmds-34 network_cmds-606.40.1 patch_cmds-17 remote_cmds-63 shell_cmds-216.60.1 system_cmds-880.60.2 text_cmds-106 --- system_cmds/getconf.tproj/progenv.gperf | 70 +++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 system_cmds/getconf.tproj/progenv.gperf (limited to 'system_cmds/getconf.tproj/progenv.gperf') diff --git a/system_cmds/getconf.tproj/progenv.gperf b/system_cmds/getconf.tproj/progenv.gperf new file mode 100644 index 0000000..4e3245a --- /dev/null +++ b/system_cmds/getconf.tproj/progenv.gperf @@ -0,0 +1,70 @@ +%{ +/* + * Copyright is disclaimed as to the contents of this file. + * + * $FreeBSD: src/usr.bin/getconf/progenv.gperf,v 1.2 2003/08/22 17:32:07 markm Exp $ + */ + +#include + +#include +#include + +#include "getconf.h" + +/* + * Override gperf's built-in external scope. + */ +static const struct map *in_word_set(const char *str); + +/* + * The Standard seems a bit ambiguous over whether the POSIX_V6_* + * are specified with or without a leading underscore, so we just + * use both. + */ +/* + * The alt_path member gives the path containing another `getconf' + * executable which was compiled using the specified programming + * environment. If it is NULL, the current executable is good enough. + * If we ever support multiple environments, this table will need to + * be updated. (We cheat here and define the supported environments + * statically.) + */ +#if defined(__alpha__) || defined(__sparc64__) +#define have_LP64_OFF64 NULL +#elif defined(__APPLE__) +#define have_LP64_OFF64 NULL +#define have_LPBIG_OFFBIG NULL +#endif + +#if defined(__i386__) || defined(__powerpc__) || defined(__x86_64__) +#define have_ILP32_OFFBIG NULL +#endif + +%} +struct map { const char *name; const char *alt_path; int valid; }; +%% +POSIX_V6_ILP32_OFF32, notdef +POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG +POSIX_V6_LP64_OFF64, have_LP64_OFF64 +POSIX_V6_LPBIG_OFFBIG, have_LPBIG_OFFBIG +_POSIX_V6_ILP32_OFF32, notdef +_POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG +_POSIX_V6_LP64_OFF64, have_LP64_OFF64 +_POSIX_V6_LPBIG_OFFBIG, have_LPBIG_OFFBIG +%% +int +find_progenv(const char *name, const char **alt_path) +{ + const struct map *rv; + + rv = in_word_set(name); + if (rv != NULL) { + if (rv->valid) { + *alt_path = rv->alt_path; + return 1; + } + return -1; + } + return 0; +} -- cgit v1.2.3-56-ge451