progenv.gperf (456f9a140f8a4ec36470b9e1c86b4cf03ddc9bc9) progenv.gperf (e9cfb9ae3ade961f80124f3cca73e8e9dae2315b)
1%{
2/*
3 * Copyright is disclaimed as to the contents of this file.
4 *
5 * $FreeBSD$
6 */
7
8#include <sys/types.h>
9
10#include <string.h>
11#include <unistd.h>
12
13#include "getconf.h"
14
15/*
16 * Override gperf's built-in external scope.
17 */
1%{
2/*
3 * Copyright is disclaimed as to the contents of this file.
4 *
5 * $FreeBSD$
6 */
7
8#include <sys/types.h>
9
10#include <string.h>
11#include <unistd.h>
12
13#include "getconf.h"
14
15/*
16 * Override gperf's built-in external scope.
17 */
18static const struct map *in_word_set(const char *str);
18static const struct map *in_word_set(const char *str, unsigned int len);
19
20/*
21 * The Standard seems a bit ambiguous over whether the POSIX_V6_*
22 * are specified with or without a leading underscore, so we just
23 * use both.
24 */
25/*
26 * The alt_path member gives the path containing another `getconf'
27 * executable which was compiled using the specified programming
28 * environment. If it is NULL, the current executable is good enough.
29 * If we ever support multiple environments, this table will need to
30 * be updated. (We cheat here and define the supported environments
31 * statically.)
32 */
19
20/*
21 * The Standard seems a bit ambiguous over whether the POSIX_V6_*
22 * are specified with or without a leading underscore, so we just
23 * use both.
24 */
25/*
26 * The alt_path member gives the path containing another `getconf'
27 * executable which was compiled using the specified programming
28 * environment. If it is NULL, the current executable is good enough.
29 * If we ever support multiple environments, this table will need to
30 * be updated. (We cheat here and define the supported environments
31 * statically.)
32 */
33#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
33#if defined(__alpha__) || defined(__sparc64__)
34#define have_LP64_OFF64 NULL
35#endif
36
37#if defined(__i386__) || defined(__powerpc__)
38#define have_ILP32_OFFBIG NULL
39#endif
40
41%}

--- 8 unchanged lines hidden (view full) ---

50_POSIX_V6_LP64_OFF64, have_LP64_OFF64
51_POSIX_V6_LPBIG_OFFBIG, notdef
52%%
53int
54find_progenv(const char *name, const char **alt_path)
55{
56 const struct map *rv;
57
34#define have_LP64_OFF64 NULL
35#endif
36
37#if defined(__i386__) || defined(__powerpc__)
38#define have_ILP32_OFFBIG NULL
39#endif
40
41%}

--- 8 unchanged lines hidden (view full) ---

50_POSIX_V6_LP64_OFF64, have_LP64_OFF64
51_POSIX_V6_LPBIG_OFFBIG, notdef
52%%
53int
54find_progenv(const char *name, const char **alt_path)
55{
56 const struct map *rv;
57
58 rv = in_word_set(name);
58 rv = in_word_set(name, strlen(name));
59 if (rv != NULL) {
60 if (rv->valid) {
61 *alt_path = rv->alt_path;
62 return 1;
63 }
64 return -1;
65 }
66 return 0;
67}
59 if (rv != NULL) {
60 if (rv->valid) {
61 *alt_path = rv->alt_path;
62 return 1;
63 }
64 return -1;
65 }
66 return 0;
67}