1 /* @(#)maxpath.h	1.14 21/07/26 Copyright 1985, 1995, 1998, 2001-2021 J. Schilling */
2 /*
3  *	Definitions for dealing with statically limitations on pathnames
4  *
5  *	Copyright (c) 1985, 1995, 1998, 2001-2021 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 #ifndef	MAXPATHLEN
67 #define	MAXPATHLEN	PATH_MAX		/* For some Solaris srcs */
68 #endif
69 
70 /*
71  * Don't use defaults here to allow recognition of problems.
72  */
73 #if !defined(FOUND_MAXFILENAME) && defined(MAXNAMELEN)
74 #	define	MAXFILENAME	MAXNAMELEN	/* From sys/param.h */
75 #	define	FOUND_MAXFILENAME
76 #endif
77 
78 #if !defined(FOUND_MAXFILENAME) && defined(MAXNAMLEN)
79 #	define	MAXFILENAME	MAXNAMLEN	/* From dirent.h    */
80 #	define	FOUND_MAXFILENAME
81 #endif
82 
83 #ifdef	__never__
84 /*
85  * DIRSIZ(dp) is a parameterized macro, we cannot use it here.
86  */
87 #if !defined(FOUND_MAXFILENAME) && defined(DIRSIZ)
88 #	define	MAXFILENAME	DIRSIZ		/* From sys/dir.h   */
89 #	define	FOUND_MAXFILENAME
90 #endif
91 #endif	/* __never__ */
92 
93 #if !defined(FOUND_MAXFILENAME) && defined(NAME_MAX)
94 #	define	MAXFILENAME	NAME_MAX	/* From limits.h    */
95 #	define	FOUND_MAXFILENAME
96 #endif
97 
98 #if !defined(FOUND_MAXFILENAME) && defined(FOUND_DIRSIZE)
99 #	define	MAXFILENAME	DIRSIZE		/* From schily/dirent.h    */
100 #	define	FOUND_MAXFILENAME
101 #endif
102 
103 #if !defined(FOUND_MAXFILENAME)
104 #include <schily/stdlib.h>
105 #endif
106 #if !defined(FOUND_MAXFILENAME) && defined(_MAX_FNAME)
107 #	define	MAXFILENAME	_MAX_FNAME	/* From MS stdlib.h */
108 #	define	FOUND_MAXFILENAME
109 #endif
110 
111 #if !defined(FOUND_MAXFILENAME)
112 #	define	MAXFILENAME	256
113 #endif
114 
115 #ifndef	NAME_MAX
116 #define	NAME_MAX	MAXFILENAME
117 #endif
118 #ifndef	MAXNAMLEN
119 #define	MAXNAMLEN	MAXFILENAME
120 #endif
121 #ifndef	MAXNAMELEN
122 #define	MAXNAMELEN	MAXFILENAME
123 #endif
124 
125 #endif	/* _SCHILY_MAXPATH_H */
126