95df74e9ba
Thanks to Samuel Tardieu <sam@inf.enst.fr> for instigating this update and providing some of the changes.
35 lines
1.0 KiB
Plaintext
35 lines
1.0 KiB
Plaintext
*** ada/i-cstrea.adb Fri Sep 24 08:42:42 1999
|
|
--- ada/i-cstrea.adb Sat Nov 6 18:33:57 1999
|
|
***************
|
|
*** 108,111 ****
|
|
--- 108,136 ----
|
|
return C_setvbuf (stream, buffer, mode, size);
|
|
end setvbuf;
|
|
|
|
+ procedure strcpy (dst : chars; src : chars);
|
|
+ pragma Import (C, strcpy);
|
|
+
|
|
+ function C_mktemp (template : chars) return chars;
|
|
+ pragma Import (C, C_mktemp, "mktemp");
|
|
+
|
|
+ procedure tmpnam (tname : chars) is
|
|
+ use type System.Address;
|
|
+ Template : String (1 .. 18) := "/var/tmp/tmp.XXXX" & ASCII.Nul;
|
|
+ Name : chars;
|
|
+ begin
|
|
+ Name := C_mktemp (Template'Address);
|
|
+ if Name /= System.Null_Address then
|
|
+ strcpy (tname'Address, Name);
|
|
+ end if;
|
|
+ end tmpnam;
|
|
+
|
|
+ function tmpfile return FILEs is
|
|
+ Name : String (1 .. L_tmpnam) := (others => ASCII.Nul);
|
|
+ Mode : String (1 .. 3) := "w+" & ASCII.Nul;
|
|
+ begin
|
|
+ tmpnam (Name'Address);
|
|
+ return (fopen (Name'Address, Mode'Address));
|
|
+ end tmpfile;
|
|
+
|
|
end Interfaces.C_Streams;
|