home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / mntlib25.zoo / fopenp.c < prev    next >
C/C++ Source or Header  |  1992-09-05  |  464b  |  23 lines

  1. /* open a file, searching along the PATH environment variable for it */
  2.  
  3. #include <stdio.h>
  4. #include <errno.h>
  5. #include <stdlib.h>
  6.  
  7. __EXTERN char *findfile __PROTO((char *fname, char *fpath, char **fext));
  8.  
  9. FILE *
  10. fopenp(name, mode)
  11.     char *name, *mode;
  12. {
  13.     extern char *findfile();
  14.     char *fullname;
  15.  
  16.     fullname = findfile(name, getenv("PATH"), (char **)0);
  17.     if (!fullname) {
  18.         errno = ENOENT;
  19.         return NULL;
  20.     }
  21.     return fopen(fullname, mode);
  22. }
  23.