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>
* 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
Make-lang.in. Store Info and generated Texinfo files in the
source directory.
......
......@@ -213,6 +213,24 @@ const int __gnat_vmsp = 1;
const int __gnat_vmsp = 0;
#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
system provides the routine readdir_r. */
#undef HAVE_READDIR_R
......
......@@ -33,6 +33,7 @@
#include <dirent.h>
extern int __gnat_max_path_len;
extern void __gnat_to_gm_time PARAMS ((int *, int *,
int *, int *,
int *, int *,
......
......@@ -48,20 +48,11 @@
#include "adaint.h"
#ifdef __EMX__
int max_path_len = _MAX_PATH;
#elif defined (VMS)
#ifdef VMS
#include <unixlib.h>
int max_path_len = 4096; /* PATH_MAX */
#elif defined (__vxworks) || defined (__OPENNT)
int max_path_len = PATH_MAX;
#else
#endif
#ifdef linux
/* Don't use macros on GNU/Linux since they cause incompatible changes between
glibc 2.0 and 2.1 */
......@@ -74,12 +65,6 @@ int max_path_len = PATH_MAX;
#ifdef stdout
# undef stdout
#endif
#endif
#include <sys/param.h>
int max_path_len = MAXPATHLEN;
#endif
/* The _IONBF value in CYGNUS or MINGW32 stdio.h is wrong. */
......@@ -185,7 +170,7 @@ __gnat_full_name (nam, buffer)
strcpy (buffer, nam);
else
{
_fullpath (buffer, nam, max_path_len);
_fullpath (buffer, nam, __gnat_max_path_len);
for (p = buffer; *p; p++)
if (*p == '/')
......@@ -210,10 +195,10 @@ __gnat_full_name (nam, buffer)
strcpy (buffer, __gnat_to_host_file_spec (buffer));
else
{
char *nambuffer = alloca (max_path_len);
char *nambuffer = alloca (__gnat_max_path_len);
strcpy (nambuffer, buffer);
strcpy (buffer, getcwd (buffer, max_path_len, 0));
strcpy (buffer, getcwd (buffer, __gnat_max_path_len, 0));
strcat (buffer, "/");
strcat (buffer, nambuffer);
strcpy (buffer, __gnat_to_host_file_spec (buffer));
......@@ -224,7 +209,7 @@ __gnat_full_name (nam, buffer)
#else
if (nam[0] != '/')
{
p = getcwd (buffer, max_path_len);
p = getcwd (buffer, __gnat_max_path_len);
if (p == 0)
{
buffer[0] = '\0';
......
......@@ -502,7 +502,7 @@ package body GNAT.Directory_Operations is
---------------------
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
Current_Dir : String (1 .. Max_Path + 1);
......
......@@ -877,7 +877,7 @@ package body GNAT.OS_Lib is
return String
is
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
procedure Get_Current_Dir
......
......@@ -283,7 +283,7 @@ private
pragma Import (C, set_binary_mode, "__gnat_set_binary_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");
-- The following may be implemented as macros, and so are supported
......
......@@ -941,7 +941,7 @@ package body Osint is
pragma Import (C, Get_Current_Dir, "__gnat_get_current_dir");
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
Current_Dir : String_Ptr;
......
......@@ -629,7 +629,7 @@ package body Xr_Tabls is
else
declare
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);
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