aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/s-os_lib.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-10-27 14:06:06 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2009-10-27 14:06:06 +0100
commit477b99b63b10d050198e60bf44d8c1d3d89d5a0b (patch)
tree0214bfd0d71f1fd62a7120a78eeb8925bd3ed168 /gcc/ada/s-os_lib.adb
parent673beced43fa873c9d4158b9c60424d5392f20a3 (diff)
downloadgcc-477b99b63b10d050198e60bf44d8c1d3d89d5a0b.zip
gcc-477b99b63b10d050198e60bf44d8c1d3d89d5a0b.tar.gz
gcc-477b99b63b10d050198e60bf44d8c1d3d89d5a0b.tar.bz2
[multiple changes]
2009-10-27 Arnaud Charlet <charlet@adacore.com> * exp_aggr.adb: Fix comment. 2009-10-27 Emmanuel Briot <briot@adacore.com> * prj-err.adb (Error_Msg): take into account continuation lines when computing whether we have a warning. 2009-10-27 Vasiliy Fofanov <fofanov@adacore.com> * make.adb, s-os_lib.adb, s-os_lib.ads (Create_Temp_Output_File): New routine that is designed to create temp file descriptor specifically for redirecting an output stream. From-SVN: r153591
Diffstat (limited to 'gcc/ada/s-os_lib.adb')
-rwxr-xr-xgcc/ada/s-os_lib.adb38
1 files changed, 36 insertions, 2 deletions
diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb
index 0f2081a..a3f4b49 100755
--- a/gcc/ada/s-os_lib.adb
+++ b/gcc/ada/s-os_lib.adb
@@ -80,6 +80,15 @@ package body System.OS_Lib is
-- Returns total number of characters needed to create a string
-- of all Args terminated by ASCII.NUL characters
+ procedure Create_Temp_File_Internal
+ (FD : out File_Descriptor;
+ Name : out String_Access;
+ Stdout : Boolean);
+ -- Internal routine to implement two Create_Temp_File routines. If Stdout
+ -- is set to True the created descriptor is stdout-compatible, otherwise
+ -- it might not be depending on the OS (VMS is one example). The first two
+ -- parameters are as in Create_Temp_File.
+
function C_String_Length (S : Address) return Integer;
-- Returns the length of a C string. Does check for null address
-- (returns 0).
@@ -749,6 +758,27 @@ package body System.OS_Lib is
(FD : out File_Descriptor;
Name : out String_Access)
is
+ begin
+ Create_Temp_File_Internal (FD, Name, Stdout => False);
+ end Create_Temp_File;
+
+ procedure Create_Temp_Output_File
+ (FD : out File_Descriptor;
+ Name : out String_Access)
+ is
+ begin
+ Create_Temp_File_Internal (FD, Name, Stdout => True);
+ end Create_Temp_Output_File;
+
+ -------------------------------
+ -- Create_Temp_File_Internal --
+ -------------------------------
+
+ procedure Create_Temp_File_Internal
+ (FD : out File_Descriptor;
+ Name : out String_Access;
+ Stdout : Boolean)
+ is
Pos : Positive;
Attempts : Natural := 0;
Current : String (Current_Temp_File_Name'Range);
@@ -814,7 +844,11 @@ package body System.OS_Lib is
-- Attempt to create the file
- FD := Create_New_File (Current, Binary);
+ if Stdout then
+ FD := Create_Output_Text_File (Current);
+ else
+ FD := Create_File (Current, Binary);
+ end if;
if FD /= Invalid_FD then
Name := new String'(Current);
@@ -836,7 +870,7 @@ package body System.OS_Lib is
end if;
end if;
end loop File_Loop;
- end Create_Temp_File;
+ end Create_Temp_File_Internal;
-----------------
-- Delete_File --