xref: /csrg-svn/lib/libc/gen/confstr.c (revision 59694)
1*59694Sbostic /*-
2*59694Sbostic  * Copyright (c) 1993 The Regents of the University of California.
3*59694Sbostic  * All rights reserved.
4*59694Sbostic  *
5*59694Sbostic  * %sccs.include.redist.c%
6*59694Sbostic  */
7*59694Sbostic 
8*59694Sbostic #if defined(LIBC_SCCS) && !defined(lint)
9*59694Sbostic static char sccsid[] = "@(#)confstr.c	5.1 (Berkeley) 05/03/93";
10*59694Sbostic #endif /* LIBC_SCCS and not lint */
11*59694Sbostic 
12*59694Sbostic #include <errno.h>
13*59694Sbostic #include <paths.h>
14*59694Sbostic #include <unistd.h>
15*59694Sbostic 
16*59694Sbostic size_t
17*59694Sbostic confstr(name, buf, len)
18*59694Sbostic 	int name;
19*59694Sbostic 	char *buf;
20*59694Sbostic 	size_t len;
21*59694Sbostic {
22*59694Sbostic 	switch (name) {
23*59694Sbostic 	case _CS_PATH:
24*59694Sbostic 		if (len != 0 && buf != NULL) {
25*59694Sbostic 			(void)strncpy(buf, _PATH_DEFPATH, len - 1);
26*59694Sbostic 			buf[len - 1] = '\0';
27*59694Sbostic 		}
28*59694Sbostic 		return (sizeof(_PATH_DEFPATH));
29*59694Sbostic 	default:
30*59694Sbostic 		errno = EINVAL;
31*59694Sbostic 		return (0);
32*59694Sbostic 	}
33*59694Sbostic 	/* NOTREACHED */
34*59694Sbostic }
35