diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-27 13:03:38 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-27 13:03:38 +0000 |
commit | b7ca89c5606272ae17507789d8ea30790fa72b38 (patch) | |
tree | 644a6bf5583a35d02fb195335ac90e6baa77489b /gcc/ada/g-os_lib.adb | |
parent | 750b3003cf2073e87515a27ef4a66f5ed83feb65 (diff) | |
download | gcc-b7ca89c5606272ae17507789d8ea30790fa72b38.tar.gz |
2004-10-26 Thomas Quinot <quinot@act-europe.fr>
* g-os_lib.ads, g-os_lib.adb (Set_Executable, Set_Writable,
Set_Read_Only): New subprograms.
These new routines allow the user to set or unset the Owner execute
and Owner write permission flags on a file.
* makegpr.adb, mlib.adb, mlib-prj.adb: Use
GNAT.OS_Lib.Set_Executable instead of rolling our own.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89654 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-os_lib.adb')
-rw-r--r-- | gcc/ada/g-os_lib.adb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/ada/g-os_lib.adb b/gcc/ada/g-os_lib.adb index 75c82e53e76..d0db36ea5ff 100644 --- a/gcc/ada/g-os_lib.adb +++ b/gcc/ada/g-os_lib.adb @@ -2056,6 +2056,48 @@ package body GNAT.OS_Lib is 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 -- ------------ |