aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/getconf/confstr.gperf
diff options
context:
space:
mode:
authorGarrett Wollman <wollman@FreeBSD.org>2000-04-26 02:36:54 +0000
committerGarrett Wollman <wollman@FreeBSD.org>2000-04-26 02:36:54 +0000
commit8c6bd995f05ac6381fa99586443ea9059d0aca1a (patch)
treeb0b5fa60b3f150bb8e0e1952fc5eebe4a1a927c1 /usr.bin/getconf/confstr.gperf
parent94a0705727be1d4d2481c4967eb73ac27ecc8b2d (diff)
downloadsrc-8c6bd995f05ac6381fa99586443ea9059d0aca1a.tar.gz
src-8c6bd995f05ac6381fa99586443ea9059d0aca1a.zip
Hello, getconf. This is a slight reinvention of the
wheel^H^H^H^H^HPOSIX.2 and X/Open utility, and rather more complicated than necessary.
Notes
Notes: svn path=/head/; revision=59632
Diffstat (limited to 'usr.bin/getconf/confstr.gperf')
-rw-r--r--usr.bin/getconf/confstr.gperf35
1 files changed, 35 insertions, 0 deletions
diff --git a/usr.bin/getconf/confstr.gperf b/usr.bin/getconf/confstr.gperf
new file mode 100644
index 000000000000..637c3ac93719
--- /dev/null
+++ b/usr.bin/getconf/confstr.gperf
@@ -0,0 +1,35 @@
+%{
+/*
+ * Copyright is disclaimed as to the contents of this file.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+#include <unistd.h>
+
+#include "getconf.h"
+
+/*
+ * Override gperf's built-in external scope.
+ */
+static const struct map *in_word_set(const char *str, unsigned int len);
+
+%}
+struct map { char *name; int key; };
+%%
+PATH, _CS_PATH
+%%
+int
+find_confstr(const char *name)
+{
+ const struct map *rv;
+
+ rv = in_word_set(name, strlen(name));
+ if (rv != 0)
+ return rv->key;
+ else
+ return -1;
+}