summaryrefslogtreecommitdiffstats
path: root/usr.bin/getconf/confstr.gperf
blob: 637c3ac937193df5311a57fc55fc1c18085cfe09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
}
OpenPOWER on IntegriCloud