* The Regents of the University of California. All rights reserved.
* %sccs.include.redist.c%
static char copyright
[] =
"@(#) Copyright (c) 1993\n\
The Regents of the University of California. All rights reserved.\n";
static char sccsid
[] = "@(#)pathconf.c 8.1 (Berkeley) %G%";
{ "link_max", CTLTYPE_INT }, \
{ "max_canon", CTLTYPE_INT }, \
{ "max_input", CTLTYPE_INT }, \
{ "name_max", CTLTYPE_INT }, \
{ "path_max", CTLTYPE_INT }, \
{ "pipe_buf", CTLTYPE_INT }, \
{ "chown_restricted", CTLTYPE_INT }, \
{ "no_trunc", CTLTYPE_INT }, \
{ "vdisable", CTLTYPE_INT }, \
struct ctlname pcnames
[] = PC_NAMES
;
struct list pclist
= { pcnames
, PC_MAXID
};
int Aflag
, aflag
, nflag
, wflag
, stdinflag
;
while ((ch
= getopt(argc
, argv
, "Aan")) != EOF
) {
if (strcmp(path
, "-") == 0)
* List all variables known to the system.
for (lvl2
= 0; lvl2
< lp
->size
; lvl2
++) {
if (lp
->list
[lvl2
].ctl_name
== 0)
parse(path
, lp
->list
[lvl2
].ctl_name
, Aflag
);
* Parse a name into an index.
* Lookup and print out the attribute if it exists.
parse(pathname
, string
, flags
)
snprintf(buf
, BUFSIZ
, "%s", string
);
if ((indx
= findname(string
, "top", &bufp
, &pclist
)) == -1)
fprintf(stderr
, "name %s in %s is unknown\n", *bufp
, string
);
value
= fpathconf(0, indx
);
value
= pathconf(pathname
, indx
);
fprintf(stderr
, "%s: value is not available\n", string
);
fprintf(stderr
, "%s: specification is incomplete\n",
fprintf(stderr
, "%s: type is unknown to this program\n",
fprintf(stdout
, "%s = ", string
);
fprintf(stdout
, "%d\n", value
);
* Scan a list of names searching for a particular name.
findname(string
, level
, bufp
, namelist
)
if (namelist
->list
== 0 || (name
= strsep(bufp
, ".")) == NULL
) {
fprintf(stderr
, "%s: incomplete specification\n", string
);
for (i
= 0; i
< namelist
->size
; i
++)
if (namelist
->list
[i
].ctl_name
!= NULL
&&
strcmp(name
, namelist
->list
[i
].ctl_name
) == 0)
if (i
== namelist
->size
) {
fprintf(stderr
, "%s level name %s in %s is invalid\n",
(void)fprintf(stderr
, "usage:\t%s\n\t%s\n\t%s\n",
"pathname [-n] variable ...",
"pathname [-n] -a", "pathname [-n] -A");