Index: trunk/src/odincrt/file.cpp
===================================================================
--- trunk/src/odincrt/file.cpp	(revision 2178)
+++ trunk/src/odincrt/file.cpp	(revision 2178)
@@ -0,0 +1,182 @@
+/* $Id: file.cpp,v 1.1 1999-12-21 12:28:07 sandervl Exp $ */
+/*
+ * Project Odin Software License can be found in LICENSE.TXT
+ * strncpy replacement (one in RTL lib is buggy; doesn't stop at 0 terminator)
+ *
+ * Copyright 1999 Sander van Leeuwen
+ * Copyright 1999 Patrick Haller
+ *
+ */
+#include <stdio.h>
+#include <os2sel.h>
+#include <wchar.h>
+
+int  _LNK_CONV os2_fclose( FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = fclose(fp);
+	return rc;
+}
+
+int _LNK_CONV os2_feof( FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = feof(fp);
+	return rc;
+}
+int _LNK_CONV os2_ferror( FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = ferror(fp);
+	return rc;
+}
+int _LNK_CONV os2_fflush( FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = fflush(fp);
+	return rc;
+}
+int _LNK_CONV os2_fgetc( FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = fgetc(fp);
+	return rc;
+}
+int _LNK_CONV os2_fgetpos( FILE *fp, fpos_t *pos)
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = fgetpos(fp,pos);
+	return rc;
+}
+char *_LNK_CONV os2_fgets( char *buf, int size, FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    char * rc;
+
+	rc = fgets(buf, size, fp);
+	return rc;
+}
+FILE * _LNK_CONV os2_fopen( const char *name, const char *type)
+{
+    unsigned short sel = RestoreOS2FS();
+    FILE * rc;
+
+	rc = fopen(name, type);
+	return rc;
+}
+int _LNK_CONV os2_fputc( int c, FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = fputc(c, fp);
+	return rc;
+}
+int _LNK_CONV os2_fputs( const char *string, FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = fputs(string, fp);
+	return rc;
+}
+size_t _LNK_CONV os2_fread( void *buf, size_t size, size_t elsize, FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    size_t rc;
+
+	rc = fread(buf, size, elsize, fp);
+	return rc;
+}
+FILE *  _LNK_CONV os2_freopen( const char *name, const char *type, FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    FILE * rc;
+
+	rc = freopen(name, type, fp);
+	return rc;
+}
+int _LNK_CONV os2_fseek( FILE *fp, long int pos, int type)
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = fseek(fp, pos, type);
+	return rc;
+}
+int _LNK_CONV os2_fsetpos( FILE *fp, const fpos_t *pos)
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = fsetpos(fp, pos);
+	return rc;
+}
+long int _LNK_CONV os2_ftell( FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    long rc;
+
+	rc = ftell(fp);
+	return rc;
+}
+size_t  _LNK_CONV os2_fwrite( const void *buf, size_t size, size_t elsize, FILE *fp )
+{
+    unsigned short sel = RestoreOS2FS();
+    size_t rc;
+
+	rc = fwrite(buf, size, elsize, fp);
+	return rc;
+}
+int _LNK_CONV os2_vfprintf( FILE *fp, const char *string, __va_list list )
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = vfprintf(fp, string, list);
+	return rc;
+}
+wint_t  _LNK_CONV os2_fgetwc(FILE *fp)
+{
+    unsigned short sel = RestoreOS2FS();
+    wint_t rc;
+
+	rc = fgetwc(fp);
+	return rc;
+}
+wchar_t * _LNK_CONV os2_fgetws(wchar_t *buf, int size, FILE *fp)
+{
+    unsigned short sel = RestoreOS2FS();
+    wchar_t * rc;
+
+	rc = fgetws(buf, size, fp);
+	return rc;
+}
+wint_t _LNK_CONV os2_fputwc(wchar_t character, FILE *fp)
+{
+    unsigned short sel = RestoreOS2FS();
+    wint_t rc;
+
+	rc = fputwc(character, fp);
+	return rc;
+}
+int _LNK_CONV os2_fputws(const wchar_t *string, FILE *fp)
+{
+    unsigned short sel = RestoreOS2FS();
+    int rc;
+
+	rc = fputws(string, fp);
+	return rc;
+}
Index: trunk/src/odincrt/makefile
===================================================================
--- trunk/src/odincrt/makefile	(revision 2177)
+++ trunk/src/odincrt/makefile	(revision 2178)
@@ -1,3 +1,3 @@
-# $Id: makefile,v 1.12 1999-12-09 10:58:14 sandervl Exp $
+# $Id: makefile,v 1.13 1999-12-21 12:28:07 sandervl Exp $
 
 #
@@ -25,5 +25,5 @@
 !endif
 
-OBJS =  odincrt.obj initterm.obj malloc.obj string.obj
+OBJS =  odincrt.obj initterm.obj malloc.obj string.obj file.obj
 
 all: $(TARGET).dll $(TARGET).lib
@@ -44,4 +44,6 @@
 odincrt.obj: odincrt.asm
 
+file.obj: file.cpp
+
 clean:
         $(RM) *.obj *.lib *.dll *.map *.pch
Index: trunk/src/odincrt/odincrt.def
===================================================================
--- trunk/src/odincrt/odincrt.def	(revision 2177)
+++ trunk/src/odincrt/odincrt.def	(revision 2178)
@@ -1,3 +1,3 @@
-; $Id: odincrt.def,v 1.19 1999-12-09 10:58:14 sandervl Exp $
+; $Id: odincrt.def,v 1.20 1999-12-21 12:28:08 sandervl Exp $
 ; Odin VAC++ 3.08 shared multithreaded runtime
 LIBRARY ODINCRT INITINSTANCE TERMINSTANCE
@@ -32,4 +32,29 @@
     __nw__FUiPCcT1 = os2__nw__FUiPCcT1                  @172
     __dl__FPvPCcUi = os2__dl__FPvPCcUi                  @201
+
+    fread = os2_fread                                             @265
+    fwrite = os2_fwrite                                            @430
+    fopen = os2_fopen                                             @293
+    fputc = os2_fputc                                             @305
+    fputs = os2_fputs                                             @311
+    fsetpos = os2_fsetpos                                           @652
+    fclose = os2_fclose                                            @354
+    fflush = os2_fflush                                            @370
+    freopen = os2_freopen                                           @612
+    fgetpos = os2_fgetpos                                           @630
+    vfprintf = os2_vfprintf                                          @755
+    feof = os2_feof                                              @230
+    ferror = os2_ferror                                            @414
+    fseek = os2_fseek                                             @271
+    ftell = os2_ftell                                             @273
+    fgetc = os2_fgetc                                             @262
+    fgets = os2_fgets                                            @267
+    fgetwc = os2_fgetwc                                            @343
+    fgetws = os2_fgetws                                            @369
+    fputwc = os2_fputwc                                            @435
+    fputws = os2_fputws                                            @478
+
+;;TODO!
+    fprintf                                           @647
   
      strdup                  			       	@472
@@ -259,5 +284,4 @@
     acos                                              @228
     rand                                              @229
-    feof                                              @230
     __udump_allocated_delta                           @231
     tanh                                              @232
@@ -291,16 +315,11 @@
     putc                                              @260
     puts                                              @261
-    fgetc                                             @262
     _ProfileThrow32                                   @263
     _cabs                                             @264
-    fread                                             @265
     ldexp                                             @266
-    fgets                                             @267
     srand                                             @268
     raise                                             @269
     _IEEE_DBL_SIGN_NEG_MASK                           @270
-    fseek                                             @271
     mblen                                             @272
-    ftell                                             @273
     _ecvt                                             @274
     set_new_handler__FPFv_v                           @275
@@ -322,5 +341,4 @@
     __ct__7istreamFP9streambufiP7ostream              @291
     floor                                             @292
-    fopen                                             @293
     __vft7ostream3ios_9strstream8iostream             @294
     wctob                                             @295
@@ -334,5 +352,4 @@
     __ct__7ostreamFP9streambuf                        @303
     wchar_out__7ostreamFiPcT1                         @304
-    fputc                                             @305
     _itoa                                             @306
     _IEEE_LDBL_ALL_EXP_MASK                           @307
@@ -340,5 +357,4 @@
     _ltoa                                             @309
     qsort                                             @310
-    fputs                                             @311
     __as__18istream_withassignFR7istream              @312
     putwc                                             @313
@@ -372,5 +388,4 @@
     __ct__7ostreamFv                                  @341
     __dt__7istreamFv                                  @342
-    fgetwc                                            @343
     __dt__7ostreamFv                                  @344
     _set_mt_terminate__FPFv_v                         @345
@@ -381,5 +396,4 @@
     _getch                                            @352
     sscanf                                            @353
-    fclose                                            @354
     signal                                            @355
     _chmod                                            @356
@@ -396,6 +410,4 @@
     rename                                            @367
     __ls__7ostreamFr                                  @368
-    fgetws                                            @369
-    fflush                                            @370
     __ls__7ostreamFw                                  @371
     _kbhit                                            @372
@@ -441,5 +453,4 @@
     wcscat                                            @412
     _mkdir                                            @413
-    ferror                                            @414
     _ultoa                                            @415
     __vft7istream3ios_19iostream_withassign8iostream  @416
@@ -457,10 +468,8 @@
     perror                                            @428
     wcsspn                                            @429
-    fwrite                                            @430
     sync__8stdiobufFv                                 @431
     setjmp                                            @432
     _Fmprs                                            @433
     _lseek                                            @434
-    fputwc                                            @435
     _Fnprs                                            @436
     strtod                                            @437
@@ -504,5 +513,4 @@
     floatfield__3ios                                  @476
     __ct__12strstreambufFPSciT1                       @477
-    fputws                                            @478
     strupr                                            @479
     __ct__8ifstreamFv                                 @480
@@ -637,5 +645,4 @@
     _eh_del                                           @610
     ls_complicated__7ostreamFSc                       @611
-    freopen                                           @612
     ls_complicated__7ostreamFUc                       @613
     ungetwc                                           @614
@@ -655,5 +662,4 @@
     iscntrl                                           @628
     mbrtowc                                           @629
-    fgetpos                                           @630
     memicmp                                           @631
     isdigit                                           @632
@@ -672,10 +678,8 @@
     getwchar                                          @645
     difftime                                          @646
-    fprintf                                           @647
     wcscoll                                           @648
     _uflush                                           @649
     wcspbrk                                           @650
     strtold                                           @651
-    fsetpos                                           @652
     _FreeFCB                                          @653
     wcsncat                                           @654
@@ -777,5 +781,4 @@
     iswupper                                          @753
     strftime                                          @754
-    vfprintf                                          @755
     _ustats                                           @756
     _NAN_STR                                          @757
