On Fri, 6 Jan 2006, Ray Lai wrote: > What are the proper uses of MAXNAMLEN, NAME_MAX, and FILENAME_MAX? > Do they represent filenames with or without paths? Do they include > the terminating null or not? The source seems inconsistent:
Posix says: "{NAME_MAX} Maximum number of bytes in a filename (not including terminating null). Minimum Acceptable Value: {_POSIX_NAME_MAX}" The other two are non-posix: MAXNAMLEN is file name length, not a path, excluding the NUL byte. FILENAME_MAX is from ANSI C, in practise it's value is equal to the posix PATH_MAX, which is the maximum length of a path name _including_ NUL. In practice, a lot of unix programs use MAXPATHLEN, which is in general equal to the posix PATH_MAX. -Otto