home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 316 / libsrc / fdopen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-20  |  581 b   |  29 lines

  1.  
  2. /* fdopen */
  3.  
  4. #include <file.h>
  5. #include "std-guts.h"
  6.  
  7. struct file * fdopen(handle, mode)
  8. int handle;
  9. char * mode;
  10. {
  11.   struct file * f;
  12.  
  13.   f = (struct file * )malloc(sizeof(struct file));
  14.   f->handle = handle;
  15.  
  16. /* I guess we have to trust that the mode string passed in matches the
  17.    one the handle was opened with ?!?  What a crock... */
  18.   f->mode = _parse_open_options(mode); 
  19.   f->file_position = 0;
  20. /* should really check first... */
  21.   f->eof_p = 0;
  22.   f->buf_index = 0;
  23.   f->buf_max = 0;
  24.   f->open_p = 1;
  25.   f->last_file_error = 0;
  26.  
  27.   return(f);
  28. }
  29.