home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff384.lzh / NorthC / Example1.LZH / clibs / UNIX / open.c < prev    next >
C/C++ Source or Header  |  1990-08-30  |  692b  |  38 lines

  1. /*
  2.   (c) 1990 S.Hawtin.
  3.   Permission is granted to copy this file provided
  4.    1) It is not used for commercial gain
  5.    2) This notice is included in all copies
  6.    3) Altered copies are marked as such
  7.  
  8.   No liability is accepted for the contents of the file.
  9.  
  10.   open.c    within        Public Domain UNIX.lib
  11.  
  12. */
  13.  
  14. #include <types.h>
  15. #include <libraries/dos.h>
  16. #include "unix.h"
  17.  
  18. extern APTR Open();
  19.  
  20. APTR
  21. open(name,mode)
  22.     char *name;
  23.     int  mode;
  24.    {/* Open the file */
  25.     long Amode;
  26.     APTR ret;
  27.  
  28.     if(mode & O_CREAT)
  29.         Amode = MODE_NEWFILE;
  30.       else
  31.         Amode = MODE_OLDFILE;
  32.     ret = Open(name,Amode);
  33.     if(ret!=0)
  34.         return(ret);
  35.       else
  36.         return(-1);
  37.     }
  38.