Rename_File (C_Old_Name'Address, C_New_Name'Address, Success);
end Rename_File;
+ --------------------
+ -- Set_Executable --
+ --------------------
+
+ procedure Set_Executable (Name : String) is
+ procedure C_Set_Executable (Name : C_File_Name);
+ pragma Import (C, C_Set_Executable, "__gnat_set_executable");
+ C_Name : aliased String (Name'First .. Name'Last + 1);
+ begin
+ C_Name (Name'Range) := Name;
+ C_Name (C_Name'Last) := ASCII.NUL;
+ C_Set_Executable (C_Name (C_Name'First)'Address);
+ end Set_Executable;
+
+ --------------------
+ -- Set_Read_Only --
+ --------------------
+
+ procedure Set_Read_Only (Name : String) is
+ procedure C_Set_Read_Only (Name : C_File_Name);
+ pragma Import (C, C_Set_Read_Only, "__gnat_set_readonly");
+ C_Name : aliased String (Name'First .. Name'Last + 1);
+ begin
+ C_Name (Name'Range) := Name;
+ C_Name (C_Name'Last) := ASCII.NUL;
+ C_Set_Read_Only (C_Name (C_Name'First)'Address);
+ end Set_Read_Only;
+
+ --------------------
+ -- Set_Writable --
+ --------------------
+
+ procedure Set_Writable (Name : String) is
+ procedure C_Set_Writable (Name : C_File_Name);
+ pragma Import (C, C_Set_Writable, "__gnat_set_writable");
+ C_Name : aliased String (Name'First .. Name'Last + 1);
+ begin
+ C_Name (Name'Range) := Name;
+ C_Name (C_Name'Last) := ASCII.NUL;
+ C_Set_Writable (C_Name (C_Name'First)'Address);
+ end Set_Writable;
+
------------
-- Setenv --
------------
-- contains the name of the file to which it is linked. Symbolic links may
-- span file systems and may refer to directories.
+ procedure Set_Writable (Name : String);
+ -- Change the permissions on the named file to make it writable
+ -- for its owner.
+
+ procedure Set_Read_Only (Name : String);
+ -- Change the permissions on the named file to make it non-writable
+ -- for its owner.
+
+ procedure Set_Executable (Name : String);
+ -- Change the permissions on the named file to make it executable
+ -- for its owner.
+
function Locate_Exec_On_Path
(Exec_Name : String) return String_Access;
-- Try to locate an executable whose name is given by Exec_Name in the
-- Returns Invalid_Time is Name doesn't correspond to an existing file.
function Is_Regular_File (Name : C_File_Name) return Boolean;
-
function Is_Directory (Name : C_File_Name) return Boolean;
-
function Is_Readable_File (Name : C_File_Name) return Boolean;
function Is_Writable_File (Name : C_File_Name) return Boolean;
function Is_Symbolic_Link (Name : C_File_Name) return Boolean;
Change_Dir (Object_Dir);
declare
- procedure Set_Executable (Name : System.Address);
- pragma Import
- (C, Set_Executable, "__gnat_set_executable");
-
- Name : constant String := Cpp_Linker & ASCII.NUL;
-
File : Ada.Text_IO.File_Type;
use Ada.Text_IO;
" $* ${LIBGCC}");
Close (File);
- Set_Executable (Name (Name'First)'Address);
+ Set_Executable (Cpp_Linker);
end;
end if;
end Choose_C_Plus_Plus_Link_Process;
Disregard : Boolean;
- procedure Set_Writable (Name : System.Address);
- pragma Import (C, Set_Writable, "__gnat_set_writable");
-
begin
Get_Name_String (Directory);
exit when Last = 0;
if Is_Regular_File (Name (1 .. Last)) then
- Name (Last + 1) := ASCII.NUL;
- Set_Writable (Name (1)'Address);
+ Set_Writable (Name (1 .. Last));
Delete_File (Name (1 .. Last), Disregard);
end if;
end loop;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.OS_Lib; use GNAT.OS_Lib;
-with System;
-
package body MLib is
-------------------
To_Dir : constant String := Get_Name_String (To);
Interface : Boolean := False;
- procedure Set_Readonly (Name : System.Address);
- pragma Import (C, Set_Readonly, "__gnat_set_readonly");
-
procedure Verbose_Copy (Index : Positive);
-- In verbose mode, output a message that the indexed file is copied
-- to the destination directory.
Success := Status and Actual_Len = Len + 3;
if Success then
- Set_Readonly (Name_Buffer'Address);
+ Set_Read_Only (
+ Name_Buffer (1 .. Name_Len - 1));
end if;
end if;
end if;