diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2008-05-29 10:56:01 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2008-05-29 10:56:01 +0200 |
commit | 686b77526599210898461b826b1c7d8c0e64408e (patch) | |
tree | cb52e4a743dca38df679be386ba0c94ca39728f9 /gcc/ada/gnatchop.adb | |
parent | fe63b1b12c7ac3e7e43afa5201c8cc7b4763d48c (diff) | |
download | gcc-686b77526599210898461b826b1c7d8c0e64408e.zip gcc-686b77526599210898461b826b1c7d8c0e64408e.tar.gz gcc-686b77526599210898461b826b1c7d8c0e64408e.tar.bz2 |
re PR ada/864 (--program-suffix is ignored (for ada))
PR ada/864
* osint.ads, osint.adb (Program_Name): New parameter "Prog" to
allow recognition of program suffix in addition to prefix.
* gnatchop.adb (Locate_Executable): Add support for prefix.
* make.adb, gnatcmd.adb, gnatlink.adb, prj-makr.adb,
mlib-utl.adb: Adjust calls to Program_Name.
From-SVN: r136149
Diffstat (limited to 'gcc/ada/gnatchop.adb')
-rw-r--r-- | gcc/ada/gnatchop.adb | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/gcc/ada/gnatchop.adb b/gcc/ada/gnatchop.adb index e7cacad..766a474 100644 --- a/gcc/ada/gnatchop.adb +++ b/gcc/ada/gnatchop.adb @@ -524,13 +524,16 @@ procedure Gnatchop is (Program_Name : String; Look_For_Prefix : Boolean := True) return String_Access is + Gnatchop_Str : constant String := "gnatchop"; Current_Command : constant String := Normalize_Pathname (Command_Name); End_Of_Prefix : Natural; Start_Of_Prefix : Positive; + Start_Of_Suffix : Positive; Result : String_Access; begin Start_Of_Prefix := Current_Command'First; + Start_Of_Suffix := Current_Command'Last + 1; End_Of_Prefix := Start_Of_Prefix - 1; if Look_For_Prefix then @@ -549,18 +552,28 @@ procedure Gnatchop is -- Find End_Of_Prefix - for J in reverse Start_Of_Prefix .. Current_Command'Last loop - if Current_Command (J) = '-' then - End_Of_Prefix := J; + for J in Start_Of_Prefix .. + Current_Command'Last - Gnatchop_Str'Length + 1 + loop + if Current_Command (J .. J + Gnatchop_Str'Length - 1) = + Gnatchop_Str + then + End_Of_Prefix := J - 1; exit; end if; end loop; end if; + if End_Of_Prefix > Current_Command'First then + Start_Of_Suffix := End_Of_Prefix + Gnatchop_Str'Length + 1; + end if; + declare Command : constant String := - Current_Command (Start_Of_Prefix .. End_Of_Prefix) & - Program_Name; + Current_Command (Start_Of_Prefix .. End_Of_Prefix) + & Program_Name + & Current_Command (Start_Of_Suffix .. + Current_Command'Last); begin Result := Locate_Exec_On_Path (Command); |