home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / mntlib32.zoo / fopenp.c < prev    next >
C/C++ Source or Header  |  1993-05-25  |  483b  |  24 lines

  1. /* open a file, searching along the PATH environment variable for it */
  2.  
  3. /* rehacked by Uwe Ohse, 3.5.93: uses buffindfile now */
  4.  
  5. #include <stdio.h>
  6. #include <errno.h>
  7. #include <stdlib.h>
  8. #include <limits.h>
  9. #include <support.h>
  10.  
  11. FILE *
  12. fopenp(name, mode)
  13.     char *name, *mode;
  14. {
  15.     char *fullname;
  16.       char buffer[PATH_MAX];
  17.       fullname = buffindfile(name, getenv("PATH"), (char **)0,buffer);
  18.     if (!fullname) {
  19.         errno = ENOENT;
  20.         return NULL;
  21.     }
  22.     return fopen(fullname, mode);
  23. }
  24.