1%{ 2/* 3 * Copyright is disclaimed as to the contents of this file. 4 *
| 1%{ 2/* 3 * Copyright is disclaimed as to the contents of this file. 4 *
|
5 * $FreeBSD: head/usr.bin/getconf/pathconf.gperf 59632 2000-04-26 02:36:54Z wollman $
| 5 * $FreeBSD: head/usr.bin/getconf/pathconf.gperf 103591 2002-09-19 03:39:03Z wollman $
|
6 */ 7 8#include <sys/types.h> 9 10#include <limits.h> 11#include <string.h> 12#include <unistd.h> 13 14#include "getconf.h" 15 16/*
| 6 */ 7 8#include <sys/types.h> 9 10#include <limits.h> 11#include <string.h> 12#include <unistd.h> 13 14#include "getconf.h" 15 16/*
|
17 * Stuff that isn't defined right now -- we want this file to work 18 * unmodified once it is defined. 19 */ 20#ifndef _PC_FILESIZEBITS 21#define _PC_FILESIZEBITS -1 22#endif 23 24/*
| |
25 * Override gperf's built-in external scope. 26 */ 27static const struct map *in_word_set(const char *str, unsigned int len); 28 29%}
| 17 * Override gperf's built-in external scope. 18 */ 19static const struct map *in_word_set(const char *str, unsigned int len); 20 21%}
|
30struct map { char *name; int key; };
| 22struct map { char *name; int key; int valid; };
|
31%% 32FILESIZEBITS, _PC_FILESIZEBITS 33LINK_MAX, _PC_LINK_MAX 34MAX_CANON, _PC_MAX_CANON 35MAX_INPUT, _PC_MAX_INPUT 36NAME_MAX, _PC_NAME_MAX 37PATH_MAX, _PC_PATH_MAX 38PIPE_BUF, _PC_PIPE_BUF
| 23%% 24FILESIZEBITS, _PC_FILESIZEBITS 25LINK_MAX, _PC_LINK_MAX 26MAX_CANON, _PC_MAX_CANON 27MAX_INPUT, _PC_MAX_INPUT 28NAME_MAX, _PC_NAME_MAX 29PATH_MAX, _PC_PATH_MAX 30PIPE_BUF, _PC_PIPE_BUF
|
| 31POSIX_ALLOC_SIZE_MIN, _PC_ALLOC_SIZE_MIN 32POSIX_REC_INCR_XFER_SIZE, _PC_REC_INCR_XFER_SIZE 33POSIX_REC_MAX_XFER_SIZE, _PC_REC_MAX_XFER_SIZE 34POSIX_REC_MIN_XFER_SIZE, _PC_REC_MIN_XFER_SIZE 35POSIX_REC_XFER_ALIGN, _PC_REC_XFER_ALIGN
|
39_POSIX_CHOWN_RESTRICTED, _PC_CHOWN_RESTRICTED 40_POSIX_NO_TRUNC, _PC_NO_TRUNC 41_POSIX_VDISABLE, _PC_VDISABLE 42_POSIX_ASYNC_IO, _PC_ASYNC_IO 43_POSIX_PRIO_IO, _PC_PRIO_IO 44_POSIX_SYNC_IO, _PC_SYNC_IO 45%% 46int
| 36_POSIX_CHOWN_RESTRICTED, _PC_CHOWN_RESTRICTED 37_POSIX_NO_TRUNC, _PC_NO_TRUNC 38_POSIX_VDISABLE, _PC_VDISABLE 39_POSIX_ASYNC_IO, _PC_ASYNC_IO 40_POSIX_PRIO_IO, _PC_PRIO_IO 41_POSIX_SYNC_IO, _PC_SYNC_IO 42%% 43int
|
47find_pathconf(const char *name)
| 44find_pathconf(const char *name, int *key)
|
48{ 49 const struct map *rv; 50 51 rv = in_word_set(name, strlen(name));
| 45{ 46 const struct map *rv; 47 48 rv = in_word_set(name, strlen(name));
|
52 if (rv != 0) 53 return rv->key; 54 else
| 49 if (rv != NULL) { 50 if (rv->valid) { 51 *key = rv->key; 52 return 1; 53 }
|
55 return -1;
| 54 return -1;
|
| 55 } 56 return 0;
|
56}
| 57}
|