1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00
freebsd/usr.bin/getconf/confstr.gperf
Garrett Wollman 8c6bd995f0 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.
2000-04-26 02:36:54 +00:00

36 lines
514 B
Plaintext

%{
/*
* 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;
}