18c6bd995SGarrett Wollman%{ 28c6bd995SGarrett Wollman/* 38c6bd995SGarrett Wollman * Copyright is disclaimed as to the contents of this file. 48c6bd995SGarrett Wollman * 58c6bd995SGarrett Wollman * $FreeBSD$ 68c6bd995SGarrett Wollman */ 78c6bd995SGarrett Wollman 88c6bd995SGarrett Wollman#include <sys/types.h> 98c6bd995SGarrett Wollman 108c6bd995SGarrett Wollman#include <limits.h> 118c6bd995SGarrett Wollman#include <string.h> 128c6bd995SGarrett Wollman#include <unistd.h> 138c6bd995SGarrett Wollman 148c6bd995SGarrett Wollman#include "getconf.h" 158c6bd995SGarrett Wollman 168c6bd995SGarrett Wollman/* 178c6bd995SGarrett Wollman * Override gperf's built-in external scope. 188c6bd995SGarrett Wollman */ 198c6bd995SGarrett Wollmanstatic const struct map *in_word_set(const char *str, unsigned int len); 208c6bd995SGarrett Wollman 218c6bd995SGarrett Wollman%} 22e9cfb9aeSGarrett Wollmanstruct map { char *name; int key; int valid; }; 238c6bd995SGarrett Wollman%% 248c6bd995SGarrett WollmanFILESIZEBITS, _PC_FILESIZEBITS 258c6bd995SGarrett WollmanLINK_MAX, _PC_LINK_MAX 268c6bd995SGarrett WollmanMAX_CANON, _PC_MAX_CANON 278c6bd995SGarrett WollmanMAX_INPUT, _PC_MAX_INPUT 288c6bd995SGarrett WollmanNAME_MAX, _PC_NAME_MAX 298c6bd995SGarrett WollmanPATH_MAX, _PC_PATH_MAX 308c6bd995SGarrett WollmanPIPE_BUF, _PC_PIPE_BUF 31e9cfb9aeSGarrett WollmanPOSIX_ALLOC_SIZE_MIN, _PC_ALLOC_SIZE_MIN 32e9cfb9aeSGarrett WollmanPOSIX_REC_INCR_XFER_SIZE, _PC_REC_INCR_XFER_SIZE 33e9cfb9aeSGarrett WollmanPOSIX_REC_MAX_XFER_SIZE, _PC_REC_MAX_XFER_SIZE 34e9cfb9aeSGarrett WollmanPOSIX_REC_MIN_XFER_SIZE, _PC_REC_MIN_XFER_SIZE 35e9cfb9aeSGarrett WollmanPOSIX_REC_XFER_ALIGN, _PC_REC_XFER_ALIGN 368c6bd995SGarrett Wollman_POSIX_CHOWN_RESTRICTED, _PC_CHOWN_RESTRICTED 378c6bd995SGarrett Wollman_POSIX_NO_TRUNC, _PC_NO_TRUNC 388c6bd995SGarrett Wollman_POSIX_VDISABLE, _PC_VDISABLE 398c6bd995SGarrett Wollman_POSIX_ASYNC_IO, _PC_ASYNC_IO 408c6bd995SGarrett Wollman_POSIX_PRIO_IO, _PC_PRIO_IO 418c6bd995SGarrett Wollman_POSIX_SYNC_IO, _PC_SYNC_IO 428c6bd995SGarrett Wollman%% 438c6bd995SGarrett Wollmanint 44e9cfb9aeSGarrett Wollmanfind_pathconf(const char *name, int *key) 458c6bd995SGarrett Wollman{ 468c6bd995SGarrett Wollman const struct map *rv; 478c6bd995SGarrett Wollman 488c6bd995SGarrett Wollman rv = in_word_set(name, strlen(name)); 49e9cfb9aeSGarrett Wollman if (rv != NULL) { 50e9cfb9aeSGarrett Wollman if (rv->valid) { 51e9cfb9aeSGarrett Wollman *key = rv->key; 52e9cfb9aeSGarrett Wollman return 1; 53e9cfb9aeSGarrett Wollman } 548c6bd995SGarrett Wollman return -1; 558c6bd995SGarrett Wollman } 56e9cfb9aeSGarrett Wollman return 0; 57e9cfb9aeSGarrett Wollman} 58