Date: Sun, 4 May 1997 13:33:24 +0300 (IDT) From: Eli Zaretskii To: DJ Delorie cc: djgpp-workers AT delorie DOT com Subject: Re: Dynamic pathconf? In-Reply-To: <199704291235.IAA00413@delorie.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Tue, 29 Apr 1997, DJ Delorie wrote: > > If not, then I can post the necessary patches (they are trivial). Then > > we could use `pathconf' as a vehicle to make DJGPP ports of Unix programs > > aware of the maximum length of the filename on any given filesystem. > > Sure, go ahead. Here they are: *** src/libc/posix/unistd/pathconf.c~0 Sun Apr 2 00:25:52 1995 --- src/libc/posix/unistd/pathconf.c Fri May 2 16:04:44 1997 *************** *** 1,6 **** --- 1,8 ---- + /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include #include + #include #include long *************** pathconf(const char *path, int name) *** 11,18 **** case _PC_LINK_MAX: return LINK_MAX; case _PC_MAX_CANON: return MAX_CANON; case _PC_MAX_INPUT: return MAX_INPUT; ! case _PC_NAME_MAX: return NAME_MAX; ! case _PC_PATH_MAX: return PATH_MAX; case _PC_PIPE_BUF: return PIPE_BUF; case _PC_CHOWN_RESTRICTED: return _POSIX_CHOWN_RESTRICTED; case _PC_NO_TRUNC: return _POSIX_NO_TRUNC; --- 13,30 ---- case _PC_LINK_MAX: return LINK_MAX; case _PC_MAX_CANON: return MAX_CANON; case _PC_MAX_INPUT: return MAX_INPUT; ! case _PC_NAME_MAX: case _PC_PATH_MAX: ! { ! int name_max, path_max; ! int e = errno; ! ! errno = 0; ! _get_volume_info (path, &name_max, &path_max, 0); ! if (errno) ! return (name == _PC_NAME_MAX) ? NAME_MAX : PATH_MAX; ! errno = e; ! return (name == _PC_NAME_MAX) ? name_max : path_max; ! } case _PC_PIPE_BUF: return PIPE_BUF; case _PC_CHOWN_RESTRICTED: return _POSIX_CHOWN_RESTRICTED; case _PC_NO_TRUNC: return _POSIX_NO_TRUNC;