[MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileNameMarshaler))]
string newpath);
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_tmpfile")]
public static extern IntPtr tmpfile ();
private static object tmpnam_lock = new object ();
}
}
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fclose")]
public static extern int fclose (IntPtr stream);
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fflush")]
public static extern int fflush (IntPtr stream);
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fopen")]
public static extern IntPtr fopen (
[MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileNameMarshaler))]
string path, string mode);
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_freopen")]
public static extern IntPtr freopen (
[MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileNameMarshaler))]
string path, string mode, IntPtr stream);
return setvbuf (stream, (IntPtr) buf, mode, size);
}
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
- EntryPoint="fprintf")]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ EntryPoint="Mono_Posix_Stdlib_fprintf")]
private static extern int sys_fprintf (IntPtr stream, string format, string message);
public static int fprintf (IntPtr stream, string message)
* vsscanf(3)
*/
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fgetc")]
public static extern int fgetc (IntPtr stream);
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
- SetLastError=true, EntryPoint="fgets")]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fgets")]
private static extern IntPtr sys_fgets (StringBuilder sb, int size, IntPtr stream);
public static StringBuilder fgets (StringBuilder sb, int size, IntPtr stream)
return fgets (sb, sb.Capacity, stream);
}
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fputc")]
public static extern int fputc (int c, IntPtr stream);
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fputs")]
public static extern int fputs (string s, IntPtr stream);
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
- public static extern int getc (IntPtr stream);
+ public static int getc (IntPtr stream)
+ {
+ return fgetc (stream);
+ }
[DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
public static extern int getchar ();
/* SKIP: gets(3) */
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
- public static extern int putc (int c, IntPtr stream);
+ public static int putc (int c, IntPtr stream)
+ {
+ return fputc (c, stream);
+ }
[DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
public static extern int putchar (int c);
[DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
public static extern int puts (string s);
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_ungetc")]
public static extern int ungetc (int c, IntPtr stream);
[CLSCompliant (false)]
SetLastError=true, EntryPoint="Mono_Posix_Stdlib_clearerr")]
public static extern int clearerr (IntPtr stream);
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_feof")]
public static extern int feof (IntPtr stream);
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ SetLastError=true, EntryPoint="Mono_Posix_Stdlib_ferror")]
public static extern int ferror (IntPtr stream);
[DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
SetLastError=true, EntryPoint="Mono_Posix_Stdlib_calloc")]
public static extern IntPtr calloc (ulong nmemb, ulong size);
- [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+ [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+ EntryPoint="Mono_Posix_Stdlib_free")]
public static extern void free (IntPtr ptr);
// malloc(3):
public StdioFileStream (string path)
{
+ if (path == null)
+ throw new ArgumentNullException ("path");
InitStream (Fopen (path, "rb"), true);
}
public StdioFileStream (string path, string mode)
{
+ if (path == null)
+ throw new ArgumentNullException ("path");
InitStream (Fopen (path, mode), true);
}
public StdioFileStream (string path, FileMode mode)
{
+ if (path == null)
+ throw new ArgumentNullException ("path");
InitStream (Fopen (path, ToFopenMode (path, mode)), true);
}
public StdioFileStream (string path, FileAccess access)
{
+ if (path == null)
+ throw new ArgumentNullException ("path");
InitStream (Fopen (path, ToFopenMode (path, access)), true);
InitCanReadWrite (access);
}
public StdioFileStream (string path, FileMode mode, FileAccess access)
{
+ if (path == null)
+ throw new ArgumentNullException ("path");
InitStream (Fopen (path, ToFopenMode (path, mode, access)), true);
InitCanReadWrite (access);
}
private static IntPtr Fopen (string path, string mode)
{
- if (path == null)
- throw new ArgumentNullException ("path");
if (path.Length == 0)
throw new ArgumentException ("path");
if (mode == null)
int Mono_Posix_Stdlib_perror (const char* s, int err);
int Mono_Posix_Stdlib_RAND_MAX (void);
void* Mono_Posix_Stdlib_realloc (void* ptr, guint64 size);
+void Mono_Posix_Stdlib_free (void* p);
int Mono_Posix_Stdlib_rewind (void* stream);
int Mono_Posix_Stdlib_setbuf (void* stream, void* buf);
void Mono_Posix_Stdlib_SetLastError (int error);
int Mono_Posix_Stdlib_setvbuf (void* stream, void* buf, int mode, guint64 size);
+void* Mono_Posix_Stdlib_fopen (char* path, char* mode);
+void* Mono_Posix_Stdlib_freopen (char* path, char* mode, void *stream);
+gint32 Mono_Posix_Stdlib_fprintf (void* stream, char* format, char *message);
+gint32 Mono_Posix_Stdlib_fgetc (void* stream);
+char* Mono_Posix_Stdlib_fgets (char* str, gint32 size, void* stream);
+gint32 Mono_Posix_Stdlib_fputc (gint32 c, void* stream);
+gint32 Mono_Posix_Stdlib_fputs (char* s, void* stream);
+gint32 Mono_Posix_Stdlib_fclose (void* stream);
+gint32 Mono_Posix_Stdlib_fflush (void* stream);
+void* Mono_Posix_Stdlib_tmpfile (void);
+gint32 Mono_Posix_Stdlib_ungetc (gint32 c, void* stream);
+gint32 Mono_Posix_Stdlib_feof (void* stream);
+gint32 Mono_Posix_Stdlib_ferror (void* stream);
void* Mono_Posix_Stdlib_SIG_DFL (void);
void* Mono_Posix_Stdlib_SIG_ERR (void);
void* Mono_Posix_Stdlib_SIG_IGN (void);
return TMP_MAX;
}
+void*
+Mono_Posix_Stdlib_tmpfile (void)
+{
+ return tmpfile ();
+}
+
gint32
Mono_Posix_Stdlib_setvbuf (void* stream, void *buf, int mode, mph_size_t size)
{
return 0;
}
+void*
+Mono_Posix_Stdlib_fopen (char* path, char* mode)
+{
+ return fopen (path, mode);
+}
+
+void*
+Mono_Posix_Stdlib_freopen (char* path, char* mode, void *stream)
+{
+ return freopen (path, mode, stream);
+}
+
+gint32
+Mono_Posix_Stdlib_fprintf (void* stream, char* format, char *message)
+{
+ return fprintf (stream, format, message);
+}
+
+gint32
+Mono_Posix_Stdlib_fgetc (void* stream)
+{
+ return fgetc (stream);
+}
+
+char*
+Mono_Posix_Stdlib_fgets (char* str, gint32 size, void* stream)
+{
+ return fgets (str, size, stream);
+}
+
+gint32
+Mono_Posix_Stdlib_fputc (gint32 c, void* stream)
+{
+ return fputc (c, stream);
+}
+
+gint32
+Mono_Posix_Stdlib_fputs (char* s, void* stream)
+{
+ return fputs (s, stream);
+}
+
+gint32
+Mono_Posix_Stdlib_fclose (void* stream)
+{
+ return fclose (stream);
+}
+
+gint32
+Mono_Posix_Stdlib_fflush (void* stream)
+{
+ return fflush (stream);
+}
+
gint32
Mono_Posix_Stdlib_fseek (void* stream, gint64 offset, int origin)
{
return 0;
}
+gint32
+Mono_Posix_Stdlib_ungetc (gint32 c, void* stream)
+{
+ return ungetc (c, stream);
+}
+
+gint32
+Mono_Posix_Stdlib_feof (void* stream)
+{
+ return feof (stream);
+}
+
+gint32
+Mono_Posix_Stdlib_ferror (void* stream)
+{
+ return ferror (stream);
+}
+
int
Mono_Posix_Stdlib_perror (const char* s, int err)
{