Changeset 632 for trunk/dll/srchpath.c


Ignore:
Timestamp:
Apr 23, 2007, 1:01:43 AM (18 years ago)
Author:
Gregg Young
Message:

Move RunFM2Util from systemf.c to srchpath.c added error includes and header to srchpath.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/srchpath.c

    r551 r632  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Path search Functions
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2003, 2007 Steven H.Levine
     10
     11  22 Apr 07 GKY Add RunFM2Util to find and run apps from the FM2Utilities
     12
     13***********************************************************************/
     14#define INCL_WIN
     15#define INCL_WINERRORS
    116#define INCL_DOS
     17#define INCL_DOSERRORS
    218
    319#include <os2.h>
     
    521#include <stdio.h>
    622#include <string.h>
     23#include <stdarg.h>
     24//#include <ctype.h>
     25//#include <time.h>
     26
     27#include "fm3dll.h"
     28#include "fm3dlg.h"
     29#include "fm3str.h"
     30
     31static PSZ pszSrcFile = __FILE__;
    732
    833#pragma data_seg(DATA1)
    9 #pragma alloc_text(MISC9,first_path,searchapath,searchpath)
     34#pragma alloc_text(MISC9,first_path,searchapath,searchpath,RunFM2Util)
     35
     36//== RunFM2Util() Find and run an app from the FM2utilities ==
     37//== Search PATH plus 2 default install dirs ==
     38
     39INT RunFM2Util(CHAR *appname, CHAR *filename)
     40{
     41    CHAR fbuf[CCHMAXPATH];
     42    APIRET rc, ret = -1;
     43
     44    rc = DosSearchPath(SEARCH_IGNORENETERRS |SEARCH_ENVIRONMENT |
     45                       SEARCH_CUR_DIRECTORY,"PATH",
     46                       appname, fbuf, CCHMAXPATH - 1);
     47      if (rc != 0) {
     48        if (rc != 2){
     49        Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     50                  "DosSearchPath", appname);
     51        return ret;
     52        }
     53        else {
     54        rc = DosSearchPath(0, "UTILS;..\\FM2Utils",
     55                           appname, fbuf, CCHMAXPATH - 1);
     56            if (rc != 0 && rc != 2){
     57              Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     58                        "DosSearchPath", appname);
     59              return ret;
     60            }
     61      }
     62    }
     63    ret = runemf2(SEPARATE | WINDOWED,
     64                  HWND_DESKTOP,
     65                  NULL,
     66                  NULL,
     67                  "%s \"%s\"",
     68                  fbuf, filename);
     69    return ret;
     70}
    1071
    1172CHAR *first_path(CHAR * path, CHAR * ret)
Note: See TracChangeset for help on using the changeset viewer.