Commit 019310ac by Florian Weimer Committed by Florian Weimer

cstreams.c (max_path_len): Move from here ...

2002-05-31  Florian Weimer  <fw@deneb.enyo.de>

	* cstreams.c (max_path_len): Move from here ...
	* adaint.c (__gnat_max_path_len): ... to here.
	* adaint.c (__gnat_max_path_len): Declare.
	* g-dirope.adb (Max_Path): Adjust.
	* g-os_lib.adb (Normalize_Pathname.Max_Path): Adjust.
	* i-cstrea.ads (max_path_len): Adjust.
	* osint.adb (Get_RTS_Search_Dir.Max_Path): Adjust.
	* xr_tabls.adb (Dir_Name.Max_Path: Adjust.

From-SVN: r54112
parent 4722213d
2002-05-31 Florian Weimer <fw@deneb.enyo.de> 2002-05-31 Florian Weimer <fw@deneb.enyo.de>
* cstreams.c (max_path_len): Move from here ...
* adaint.c (__gnat_max_path_len): ... to here.
* adaint.c (__gnat_max_path_len): Declare.
* g-dirope.adb (Max_Path): Adjust.
* g-os_lib.adb (Normalize_Pathname.Max_Path): Adjust.
* i-cstrea.ads (max_path_len): Adjust.
* osint.adb (Get_RTS_Search_Dir.Max_Path): Adjust.
* xr_tabls.adb (Dir_Name.Max_Path: Adjust.
* Makefile.in, Make-lang.in: Documentation is now built in * Makefile.in, Make-lang.in: Documentation is now built in
Make-lang.in. Store Info and generated Texinfo files in the Make-lang.in. Store Info and generated Texinfo files in the
source directory. source directory.
......
...@@ -213,6 +213,24 @@ const int __gnat_vmsp = 1; ...@@ -213,6 +213,24 @@ const int __gnat_vmsp = 1;
const int __gnat_vmsp = 0; const int __gnat_vmsp = 0;
#endif #endif
/* This variable is used to export the maximum length of a path name to
Ada code. */
#ifdef __EMX__
int __gnat_max_path_len = _MAX_PATH;
#elif defined (VMS)
int __gnat_max_path_len = 4096; /* PATH_MAX */
#elif defined (__vxworks) || defined (__OPENNT)
int __gnat_max_path_len = PATH_MAX;
#else
#include <sys/param.h>
int __gnat_max_path_len = MAXPATHLEN;
#endif
/* The following macro HAVE_READDIR_R should be defined if the /* The following macro HAVE_READDIR_R should be defined if the
system provides the routine readdir_r. */ system provides the routine readdir_r. */
#undef HAVE_READDIR_R #undef HAVE_READDIR_R
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <dirent.h> #include <dirent.h>
extern int __gnat_max_path_len;
extern void __gnat_to_gm_time PARAMS ((int *, int *, extern void __gnat_to_gm_time PARAMS ((int *, int *,
int *, int *, int *, int *,
int *, int *, int *, int *,
......
...@@ -48,20 +48,11 @@ ...@@ -48,20 +48,11 @@
#include "adaint.h" #include "adaint.h"
#ifdef __EMX__ #ifdef VMS
int max_path_len = _MAX_PATH;
#elif defined (VMS)
#include <unixlib.h> #include <unixlib.h>
int max_path_len = 4096; /* PATH_MAX */ #endif
#elif defined (__vxworks) || defined (__OPENNT)
int max_path_len = PATH_MAX;
#else
#ifdef linux #ifdef linux
/* Don't use macros on GNU/Linux since they cause incompatible changes between /* Don't use macros on GNU/Linux since they cause incompatible changes between
glibc 2.0 and 2.1 */ glibc 2.0 and 2.1 */
...@@ -74,12 +65,6 @@ int max_path_len = PATH_MAX; ...@@ -74,12 +65,6 @@ int max_path_len = PATH_MAX;
#ifdef stdout #ifdef stdout
# undef stdout # undef stdout
#endif #endif
#endif
#include <sys/param.h>
int max_path_len = MAXPATHLEN;
#endif #endif
/* The _IONBF value in CYGNUS or MINGW32 stdio.h is wrong. */ /* The _IONBF value in CYGNUS or MINGW32 stdio.h is wrong. */
...@@ -185,7 +170,7 @@ __gnat_full_name (nam, buffer) ...@@ -185,7 +170,7 @@ __gnat_full_name (nam, buffer)
strcpy (buffer, nam); strcpy (buffer, nam);
else else
{ {
_fullpath (buffer, nam, max_path_len); _fullpath (buffer, nam, __gnat_max_path_len);
for (p = buffer; *p; p++) for (p = buffer; *p; p++)
if (*p == '/') if (*p == '/')
...@@ -210,10 +195,10 @@ __gnat_full_name (nam, buffer) ...@@ -210,10 +195,10 @@ __gnat_full_name (nam, buffer)
strcpy (buffer, __gnat_to_host_file_spec (buffer)); strcpy (buffer, __gnat_to_host_file_spec (buffer));
else else
{ {
char *nambuffer = alloca (max_path_len); char *nambuffer = alloca (__gnat_max_path_len);
strcpy (nambuffer, buffer); strcpy (nambuffer, buffer);
strcpy (buffer, getcwd (buffer, max_path_len, 0)); strcpy (buffer, getcwd (buffer, __gnat_max_path_len, 0));
strcat (buffer, "/"); strcat (buffer, "/");
strcat (buffer, nambuffer); strcat (buffer, nambuffer);
strcpy (buffer, __gnat_to_host_file_spec (buffer)); strcpy (buffer, __gnat_to_host_file_spec (buffer));
...@@ -224,7 +209,7 @@ __gnat_full_name (nam, buffer) ...@@ -224,7 +209,7 @@ __gnat_full_name (nam, buffer)
#else #else
if (nam[0] != '/') if (nam[0] != '/')
{ {
p = getcwd (buffer, max_path_len); p = getcwd (buffer, __gnat_max_path_len);
if (p == 0) if (p == 0)
{ {
buffer[0] = '\0'; buffer[0] = '\0';
......
...@@ -502,7 +502,7 @@ package body GNAT.Directory_Operations is ...@@ -502,7 +502,7 @@ package body GNAT.Directory_Operations is
--------------------- ---------------------
Max_Path : Integer; Max_Path : Integer;
pragma Import (C, Max_Path, "max_path_len"); pragma Import (C, Max_Path, "__gnat_max_path_len");
function Get_Current_Dir return Dir_Name_Str is function Get_Current_Dir return Dir_Name_Str is
Current_Dir : String (1 .. Max_Path + 1); Current_Dir : String (1 .. Max_Path + 1);
......
...@@ -877,7 +877,7 @@ package body GNAT.OS_Lib is ...@@ -877,7 +877,7 @@ package body GNAT.OS_Lib is
return String return String
is is
Max_Path : Integer; Max_Path : Integer;
pragma Import (C, Max_Path, "max_path_len"); pragma Import (C, Max_Path, "__gnat_max_path_len");
-- Maximum length of a path name -- Maximum length of a path name
procedure Get_Current_Dir procedure Get_Current_Dir
......
...@@ -283,7 +283,7 @@ private ...@@ -283,7 +283,7 @@ private
pragma Import (C, set_binary_mode, "__gnat_set_binary_mode"); pragma Import (C, set_binary_mode, "__gnat_set_binary_mode");
pragma Import (C, set_text_mode, "__gnat_set_text_mode"); pragma Import (C, set_text_mode, "__gnat_set_text_mode");
pragma Import (C, max_path_len, "max_path_len"); pragma Import (C, max_path_len, "__gnat_max_path_len");
pragma Import (C, full_name, "__gnat_full_name"); pragma Import (C, full_name, "__gnat_full_name");
-- The following may be implemented as macros, and so are supported -- The following may be implemented as macros, and so are supported
......
...@@ -941,7 +941,7 @@ package body Osint is ...@@ -941,7 +941,7 @@ package body Osint is
pragma Import (C, Get_Current_Dir, "__gnat_get_current_dir"); pragma Import (C, Get_Current_Dir, "__gnat_get_current_dir");
Max_Path : Integer; Max_Path : Integer;
pragma Import (C, Max_Path, "max_path_len"); pragma Import (C, Max_Path, "__gnat_max_path_len");
-- Maximum length of a path name -- Maximum length of a path name
Current_Dir : String_Ptr; Current_Dir : String_Ptr;
......
...@@ -629,7 +629,7 @@ package body Xr_Tabls is ...@@ -629,7 +629,7 @@ package body Xr_Tabls is
else else
declare declare
Max_Path : Integer; Max_Path : Integer;
pragma Import (C, Max_Path, "max_path_len"); pragma Import (C, Max_Path, "__gnat_max_path_len");
Base2 : Dir_Name_Str (1 .. Max_Path); Base2 : Dir_Name_Str (1 .. Max_Path);
Last : Natural; Last : Natural;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment