home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / FINDPRO.C < prev    next >
Text File  |  1991-09-19  |  5KB  |  66 lines

  1. /*****************************************************************************/
  2. /* File:                                             IBM INTERNAL USE ONLY   */
  3. /*   findpro.c                                                               */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*                                                                           */
  7. /*  Find SD386.PRO.                                                          */
  8. /*                                                                           */
  9. /*                                                                           */
  10. /* History:                                                                  */
  11. /*                                                                           */
  12. /*   02/08/91 Creation of 32-bit SD386, from 16-bit version.                 */
  13. /*                                                                           */
  14. /**Includes*******************************************************************/
  15.  
  16. #include "all.h"                        /* SD386 include files               */
  17.  
  18. /*****************************************************************************/
  19. /* findpro()                                                                 */
  20. /*                                                                           */
  21. /* Description:                                                              */
  22. /*                                                                           */
  23. /*   find SD386.PRO.                                                         */
  24. /*                                                                           */
  25. /* Parameters:                                                               */
  26. /*                                                                           */
  27. /*   fs        input - the passed filespec.                                  */
  28. /*   pn        input - -> to callers "fully qualified filespec" buffer.      */
  29. /*   pnlen     input - length of the caller's buffer.                        */
  30. /*                                                                           */
  31. /* Return:                                                                   */
  32. /*                                                                           */
  33. /*   void                                                                    */
  34. /*                                                                           */
  35. /* Assumptions:                                                              */
  36. /*                                                                           */
  37. /*   none.                                                                   */
  38. /*                                                                           */
  39. /*****************************************************************************/
  40.  void
  41. findpro(char *fs,char *pn,uint pnlen)   /* fs :: the passed filespec         */
  42.                                         /* pn :: the caller's buffer         */
  43.                                         /* pnlen :: caller's buffer length   */
  44. {                                       /*                                   */
  45.  char       *fn;                        /* profile file name.                */
  46.  USHORT     control;                    /* control word for DosSearchPath    */
  47.  uint       rc;                         /* DosSearchPath return code         */
  48.                                         /*                                   */
  49. /*****************************************************************************/
  50. /* First, look in the current directory.                                     */
  51. /*****************************************************************************/
  52.  fn = fs;                               /*                                   */
  53.  control = 0;                           /* no impied current directory       */
  54.  rc= DosSearchPath(control,".\\",fn,pn,pnlen); /* look for the file          */
  55.  if ( rc==0 )                           /* if we found it then               */
  56.   return;                               /* return.                           */
  57. /*****************************************************************************/
  58. /* Now look along the DPATH environment variable.                            */
  59. /*****************************************************************************/
  60.  control = 2;                          /* use path reference as env variable */
  61.  rc=DosSearchPath(control,"DPATH",fn,pn,pnlen);    /* look for it            */
  62.  if( rc==0)                             /*                                   */
  63.   return;                               /*                                   */
  64.  pn = NULL;                             /* OUT OF LUCK CHIEF.                */
  65. }                                       /*                                   */
  66.