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