]>
Commit | Line | Data |
---|---|---|
1 | %{ | |
2 | /* | |
3 | * Copyright is disclaimed as to the contents of this file. | |
4 | * | |
5 | * $FreeBSD: src/usr.bin/getconf/confstr.gperf,v 1.5 2003/08/22 17:32:07 markm Exp $ | |
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 | */ | |
18 | static const struct map *in_word_set(const char *str); | |
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 | struct map { const char *name; int key; int valid; }; | |
27 | %% | |
28 | PATH, _CS_PATH | |
29 | POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS | |
30 | POSIX_V6_ILP32_OFF32_LDFLAGS, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS | |
31 | POSIX_V6_ILP32_OFF32_LIBS, _CS_POSIX_V6_ILP32_OFF32_LIBS | |
32 | POSIX_V6_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS | |
33 | POSIX_V6_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS | |
34 | POSIX_V6_ILP32_OFFBIG_LIBS, _CS_POSIX_V6_ILP32_OFFBIG_LIBS | |
35 | POSIX_V6_LP64_OFF64_CFLAGS, _CS_POSIX_V6_LP64_OFF64_CFLAGS | |
36 | POSIX_V6_LP64_OFF64_LDFLAGS, _CS_POSIX_V6_LP64_OFF64_LDFLAGS | |
37 | POSIX_V6_LP64_OFF64_LIBS, _CS_POSIX_V6_LP64_OFF64_LIBS | |
38 | POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS | |
39 | POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS | |
40 | POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS | |
41 | POSIX_V6_WIDTH_RESTRICTED_ENVS, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS | |
42 | _POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS | |
43 | _POSIX_V6_ILP32_OFF32_LDFLAGS, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS | |
44 | _POSIX_V6_ILP32_OFF32_LIBS, _CS_POSIX_V6_ILP32_OFF32_LIBS | |
45 | _POSIX_V6_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS | |
46 | _POSIX_V6_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS | |
47 | _POSIX_V6_ILP32_OFFBIG_LIBS, _CS_POSIX_V6_ILP32_OFFBIG_LIBS | |
48 | _POSIX_V6_LP64_OFF64_CFLAGS, _CS_POSIX_V6_LP64_OFF64_CFLAGS | |
49 | _POSIX_V6_LP64_OFF64_LDFLAGS, _CS_POSIX_V6_LP64_OFF64_LDFLAGS | |
50 | _POSIX_V6_LP64_OFF64_LIBS, _CS_POSIX_V6_LP64_OFF64_LIBS | |
51 | _POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS | |
52 | _POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS | |
53 | _POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS | |
54 | _POSIX_V6_WIDTH_RESTRICTED_ENVS, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS | |
55 | DARWIN_USER_DIR, _CS_DARWIN_USER_DIR | |
56 | DARWIN_USER_TEMP_DIR, _CS_DARWIN_USER_TEMP_DIR | |
57 | DARWIN_USER_CACHE_DIR, _CS_DARWIN_USER_CACHE_DIR | |
58 | %% | |
59 | int | |
60 | find_confstr(const char *name, int *key) | |
61 | { | |
62 | const struct map *rv; | |
63 | ||
64 | rv = in_word_set(name); | |
65 | if (rv != NULL) { | |
66 | if (rv->valid) { | |
67 | *key = rv->key; | |
68 | return 1; | |
69 | } | |
70 | return -1; | |
71 | } | |
72 | return 0; | |
73 | } |