1 /* @(#)maxpath.h	1.13 17/04/27 Copyright 1985, 1995, 1998, 2001-2017 J. Schilling */
2 /*
3  *	Definitions for dealing with statically limitations on pathnames
4  *
5  *	Copyright (c) 1985, 1995, 1998, 2001-2017 J. Schilling
6  */
7 /*
8  * The contents of this file are subject to the terms of the
9  * Common Development and Distribution License, Version 1.0 only
10  * (the "License").  You may not use this file except in compliance
11  * with the License.
12  *
13  * See the file CDDL.Schily.txt in this distribution for details.
14  * A copy of the CDDL is also available via the Internet at
15  * http://www.opensource.org/licenses/cddl1.txt
16  *
17  * When distributing Covered Code, include this CDDL HEADER in each
18  * file and include the License file CDDL.Schily.txt from this distribution.
19  */
20 
21 #ifndef	_SCHILY_MAXPATH_H
22 #define	_SCHILY_MAXPATH_H
23 
24 #ifndef	_SCHILY_DIRENT_H
25 #include <schily/dirent.h>		/* Includes mconfig.h if needed	*/
26 #endif
27 
28 #ifdef	JOS
29 #ifndef	_SCHILY_JOS_MAXP_H
30 #	include <schily/jos_maxp.h>
31 #endif
32 #	ifndef	FOUND_MAXPATHNAME
33 #	define	FOUND_MAXPATHNAME
34 #	endif
35 #	ifndef	FOUND_MAXFILENAME
36 #	define	FOUND_MAXFILENAME
37 #	endif
38 #endif	/* JOS */
39 
40 #if !defined(FOUND_MAXPATHNAME) && defined(MAXPATHLEN)
41 #	define	MAXPATHNAME	MAXPATHLEN	/* From sys/param.h */
42 #	define	FOUND_MAXPATHNAME
43 #endif
44 
45 #if !defined(FOUND_MAXPATHNAME) && defined(PATH_MAX)
46 #	define	MAXPATHNAME	PATH_MAX	/* From limits.h    */
47 #	define	FOUND_MAXPATHNAME
48 #endif
49 
50 #if !defined(FOUND_MAXPATHNAME)
51 #include <schily/stdlib.h>
52 #endif
53 #if !defined(FOUND_MAXPATHNAME) && defined(_MAX_PATH)
54 #	define	MAXPATHNAME	_MAX_PATH	/* From MS stdlib.h */
55 #	define	FOUND_MAXPATHNAME
56 #endif
57 
58 #if !defined(FOUND_MAXPATHNAME)
59 #	define	MAXPATHNAME	1024		/* Is there a limit? */
60 #endif
61 
62 #ifndef	PATH_MAX
63 #define	PATH_MAX	MAXPATHNAME
64 #endif
65 
66 
67 /*
68  * Don't use defaults here to allow recognition of problems.
69  */
70 #if !defined(FOUND_MAXFILENAME) && defined(MAXNAMELEN)
71 #	define	MAXFILENAME	MAXNAMELEN	/* From sys/param.h */
72 #	define	FOUND_MAXFILENAME
73 #endif
74 
75 #if !defined(FOUND_MAXFILENAME) && defined(MAXNAMLEN)
76 #	define	MAXFILENAME	MAXNAMLEN	/* From dirent.h    */
77 #	define	FOUND_MAXFILENAME
78 #endif
79 
80 #ifdef	__never__
81 /*
82  * DIRSIZ(dp) is a parameterized macro, we cannot use it here.
83  */
84 #if !defined(FOUND_MAXFILENAME) && defined(DIRSIZ)
85 #	define	MAXFILENAME	DIRSIZ		/* From sys/dir.h   */
86 #	define	FOUND_MAXFILENAME
87 #endif
88 #endif	/* __never__ */
89 
90 #if !defined(FOUND_MAXFILENAME) && defined(NAME_MAX)
91 #	define	MAXFILENAME	NAME_MAX	/* From limits.h    */
92 #	define	FOUND_MAXFILENAME
93 #endif
94 
95 #if !defined(FOUND_MAXFILENAME) && defined(FOUND_DIRSIZE)
96 #	define	MAXFILENAME	DIRSIZE		/* From schily/dirent.h    */
97 #	define	FOUND_MAXFILENAME
98 #endif
99 
100 #if !defined(FOUND_MAXFILENAME)
101 #include <schily/stdlib.h>
102 #endif
103 #if !defined(FOUND_MAXFILENAME) && defined(_MAX_FNAME)
104 #	define	MAXFILENAME	_MAX_FNAME	/* From MS stdlib.h */
105 #	define	FOUND_MAXFILENAME
106 #endif
107 
108 #if !defined(FOUND_MAXFILENAME)
109 #	define	MAXFILENAME	256
110 #endif
111 
112 #ifndef	NAME_MAX
113 #define	NAME_MAX	MAXFILENAME
114 #endif
115 #ifndef	MAXNAMLEN
116 #define	MAXNAMLEN	MAXFILENAME
117 #endif
118 #ifndef	MAXNAMELEN
119 #define	MAXNAMELEN	MAXFILENAME
120 #endif
121 
122 #endif	/* _SCHILY_MAXPATH_H */
123