Rev | Line | |
---|
[9] | 1 | /* POSIX pathconf (Sec. 5.7.1) Author: Andy Tanenbaum */
|
---|
| 2 |
|
---|
| 3 | #include <lib.h>
|
---|
| 4 | #define close _close
|
---|
| 5 | #define open _open
|
---|
| 6 | #define pathconf _pathconf
|
---|
| 7 | #include <fcntl.h>
|
---|
| 8 | #include <errno.h>
|
---|
| 9 | #include <unistd.h>
|
---|
| 10 |
|
---|
| 11 | PUBLIC long pathconf(path, name)
|
---|
| 12 | _CONST char *path; /* name of file being interrogated */
|
---|
| 13 | int name; /* property being inspected */
|
---|
| 14 | {
|
---|
| 15 | /* POSIX allows some of the values in <limits.h> to be increased at
|
---|
| 16 | * run time. The pathconf and fpathconf functions allow these values
|
---|
| 17 | * to be checked at run time. MINIX does not use this facility.
|
---|
| 18 | * The run-time limits are those given in <limits.h>.
|
---|
| 19 | */
|
---|
| 20 |
|
---|
| 21 | int fd;
|
---|
| 22 | long val;
|
---|
| 23 |
|
---|
| 24 | if ( (fd = open(path, O_RDONLY)) < 0) return(-1L);
|
---|
| 25 | val = fpathconf(fd, name);
|
---|
| 26 | close(fd);
|
---|
| 27 | return(val);
|
---|
| 28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.