home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / FOPENX.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  2KB  |  52 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **          MFL.LIB  function source code
  5. **  Copyright 1986, S.E. Margison
  6. **
  7. **  Modified 1989-93; Copyright Robert B.Stout dba MicroFirm as part of the
  8. **  MicroFirm Function Library (MFL).
  9. **                                                                      
  10. **  The user is granted a free limited license to use this source file  
  11. **  to create royalty-free programs, subject to the terms of the        
  12. **  license restrictions specified in the LICENSE.MFL file.             
  13. **                                                                      
  14. **  FUNCTION: fopenp, fopend, fopeng
  15. **
  16. **  Perform fopen() in path, stated environment, or both.
  17. **  Current directory is always attempted first.
  18. **  For fopeng() environment variable is searched before path
  19. **  DRIVE and DIRECTORY strings may NOT be specified as part
  20. **  of the filename.
  21. */
  22.  
  23. #include <stdio.h>
  24. #include "snipfile.h"
  25.  
  26. FILE *fopenp(char *name, char *mode)
  27. {
  28.         char *newname;
  29.  
  30.         if (NULL != (newname = pexists(name)))
  31.                 return(fopen(newname, mode));
  32.         else    return NULL;
  33. }
  34.  
  35. FILE *fopend(char *name, char *mode, char *envar)
  36. {
  37.         char *newname;
  38.  
  39.         if (NULL != (newname = dexists(name, envar)))
  40.                 return(fopen(newname, mode));
  41.         else    return NULL;
  42. }
  43.  
  44. FILE *fopeng(char *name, char *mode, char *envar)
  45. {
  46.         char *newname;
  47.  
  48.         if (NULL != (newname = gexists(name, envar)))
  49.                 return(fopen(newname, mode));
  50.         else    return NULL;
  51. }
  52.