diff options
Diffstat (limited to 'gcc/ada/gnatname.adb')
-rw-r--r-- | gcc/ada/gnatname.adb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ada/gnatname.adb b/gcc/ada/gnatname.adb index fb35abb388a..b38fac06f61 100644 --- a/gcc/ada/gnatname.adb +++ b/gcc/ada/gnatname.adb @@ -25,12 +25,14 @@ ------------------------------------------------------------------------------ with Gnatvsn; +with Hostparm; with Opt; with Osint; use Osint; with Output; use Output; with Prj.Makr; with Table; +with Ada.Command_Line; use Ada.Command_Line; with Ada.Text_IO; use Ada.Text_IO; with GNAT.Command_Line; use GNAT.Command_Line; with GNAT.OS_Lib; use GNAT.OS_Lib; @@ -296,6 +298,38 @@ procedure Gnatname is -- Start of processing for Gnatname begin + -- Add the directory where gnatname is invoked in front of the + -- path, if gnatname is invoked with directory information. + -- Only do this if the platform is not VMS, where the notion of path + -- does not really exist. + + if not Hostparm.OpenVMS then + declare + Command : constant String := Command_Name; + + begin + for Index in reverse Command'Range loop + if Command (Index) = Directory_Separator then + declare + Absolute_Dir : constant String := + Normalize_Pathname + (Command (Command'First .. Index)); + + PATH : constant String := + Absolute_Dir & + Path_Separator & + Getenv ("PATH").all; + + begin + Setenv ("PATH", PATH); + end; + + exit; + end if; + end loop; + end; + end if; + -- Initialize tables Excluded_Patterns.Set_Last (0); |