1%{ 2/* 3 * Copyright is disclaimed as to the contents of this file. 4 * 5 * $FreeBSD$ 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 */ 18static const struct map *in_word_set(const char *str); 19 20%} 21struct map { const char *name; int key; int valid; }; 22%% 23FILESIZEBITS, _PC_FILESIZEBITS 24LINK_MAX, _PC_LINK_MAX 25MAX_CANON, _PC_MAX_CANON 26MAX_INPUT, _PC_MAX_INPUT 27NAME_MAX, _PC_NAME_MAX 28PATH_MAX, _PC_PATH_MAX 29PIPE_BUF, _PC_PIPE_BUF 30POSIX_ALLOC_SIZE_MIN, _PC_ALLOC_SIZE_MIN 31POSIX_REC_INCR_XFER_SIZE, _PC_REC_INCR_XFER_SIZE 32POSIX_REC_MAX_XFER_SIZE, _PC_REC_MAX_XFER_SIZE 33POSIX_REC_MIN_XFER_SIZE, _PC_REC_MIN_XFER_SIZE 34POSIX_REC_XFER_ALIGN, _PC_REC_XFER_ALIGN 35SYMLINK_MAX, _PC_SYMLINK_MAX 36TRUSTEDBSD_ACL_EXTENDED, _PC_ACL_EXTENDED 37TRUSTEDBSD_ACL_PATH_MAX, _PC_ACL_PATH_MAX 38TRUSTEDBSD_CAP_PRESENT, _PC_CAP_PRESENT 39TRUSTEDBSD_INF_PRESENT, _PC_INF_PRESENT 40TRUSTEDBSD_MAC_PRESENT, _PC_MAC_PRESENT 41_POSIX_CHOWN_RESTRICTED, _PC_CHOWN_RESTRICTED 42_POSIX_NO_TRUNC, _PC_NO_TRUNC 43_POSIX_VDISABLE, _PC_VDISABLE 44_POSIX_ASYNC_IO, _PC_ASYNC_IO 45_POSIX_PRIO_IO, _PC_PRIO_IO 46_POSIX_SYNC_IO, _PC_SYNC_IO 47%% 48int 49find_pathconf(const char *name, int *key) 50{ 51 const struct map *rv; 52 53 rv = in_word_set(name); 54 if (rv != NULL) { 55 if (rv->valid) { 56 *key = rv->key; 57 return 1; 58 } 59 return -1; 60 } 61 return 0; 62} 63