From 830e86dd5610c2435e0ba7fa881cff75de0f1dcd Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Thu, 13 Jan 2005 13:58:33 +0000 Subject: * Stdlib.cs: Use Stdlib.LIBC instead of "libc". * StdioFileStream.cs: Add FilePosition property (not that I expect anyone to use it) and Rewind() method. svn path=/trunk/mcs/; revision=38870 --- mcs/class/Mono.Posix/Mono.Unix/ChangeLog | 6 ++++++ mcs/class/Mono.Posix/Mono.Unix/StdioFileStream.cs | 20 ++++++++++++++++++++ mcs/class/Mono.Posix/Mono.Unix/Stdlib.cs | 8 ++++---- 3 files changed, 30 insertions(+), 4 deletions(-) (limited to 'mcs/class/Mono.Posix') diff --git a/mcs/class/Mono.Posix/Mono.Unix/ChangeLog b/mcs/class/Mono.Posix/Mono.Unix/ChangeLog index 538045fe495..c67c572ae38 100644 --- a/mcs/class/Mono.Posix/Mono.Unix/ChangeLog +++ b/mcs/class/Mono.Posix/Mono.Unix/ChangeLog @@ -1,3 +1,9 @@ +2005-01-13 Jonathan Pryor + + * Stdlib.cs: Use Stdlib.LIBC instead of "libc". + * StdioFileStream.cs: Add FilePosition property (not that I expect anyone to + use it) and Rewind() method. + 2005-01-05 Jonathan Pryor * StdioFileStream.cs: Added; System.IO.Stream wrapper for C FILE struct. diff --git a/mcs/class/Mono.Posix/Mono.Unix/StdioFileStream.cs b/mcs/class/Mono.Posix/Mono.Unix/StdioFileStream.cs index 7f2d04ebf5e..23c1f3c53e6 100644 --- a/mcs/class/Mono.Posix/Mono.Unix/StdioFileStream.cs +++ b/mcs/class/Mono.Posix/Mono.Unix/StdioFileStream.cs @@ -123,6 +123,21 @@ namespace Mono.Unix { } } + public FilePosition FilePosition { + get { + FilePosition pos = new FilePosition (); + int r = Stdlib.fgetpos (file, pos); + UnixMarshal.ThrowExceptionForLastErrorIf (r); + return pos; + } + set { + if (value == null) + throw new ArgumentNullException ("value"); + int r = Stdlib.fsetpos (file, value); + UnixMarshal.ThrowExceptionForLastErrorIf (r); + } + } + public override void Flush () { int r = Stdlib.fflush (file); @@ -164,6 +179,11 @@ namespace Mono.Unix { throw new ArgumentException ("would overrun buffer"); } + public void Rewind () + { + Stdlib.rewind (file); + } + public override long Seek (long offset, SeekOrigin origin) { AssertNotDisposed (); diff --git a/mcs/class/Mono.Posix/Mono.Unix/Stdlib.cs b/mcs/class/Mono.Posix/Mono.Unix/Stdlib.cs index b57f5b633f3..37d894c4bc7 100644 --- a/mcs/class/Mono.Posix/Mono.Unix/Stdlib.cs +++ b/mcs/class/Mono.Posix/Mono.Unix/Stdlib.cs @@ -97,17 +97,17 @@ namespace Mono.Unix { static XPrintfFunctions () { - CdeclFunction _printf = new CdeclFunction ("libc", "printf", typeof(int)); + CdeclFunction _printf = new CdeclFunction (Stdlib.LIBC, "printf", typeof(int)); printf = new XPrintf (_printf.Invoke); - CdeclFunction _fprintf = new CdeclFunction ("libc", "fprintf", typeof(int)); + CdeclFunction _fprintf = new CdeclFunction (Stdlib.LIBC, "fprintf", typeof(int)); fprintf = new XPrintf (_fprintf.Invoke); - CdeclFunction _snprintf = new CdeclFunction ("MonoPosixHelper", + CdeclFunction _snprintf = new CdeclFunction (Stdlib.MPH, "Mono_Posix_Stdlib_snprintf", typeof(int)); snprintf = new XPrintf (_snprintf.Invoke); - CdeclFunction _syslog = new CdeclFunction ("libc", "syslog", typeof(void)); + CdeclFunction _syslog = new CdeclFunction (Stdlib.LIBC, "syslog", typeof(void)); syslog = new XPrintf (_syslog.Invoke); } } -- cgit v1.2.3