Changeset 1761 for trunk/dll/pathutil.c


Ignore:
Timestamp:
Mar 22, 2014, 12:29:52 AM (11 years ago)
Author:
Steven Levine
Message:

Implement IsAbsolutePath and modify SearchPathForFile to use

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/pathutil.c

    r1750 r1761  
    1414  15 Oct 08 GKY Fix NormalizeCmdLine to check all 5 executable extensions when no extension provided;
    1515                use searchapath to check for existance of file types not checked by DosQAppType;
    16                 close DosFind.
     16                close DosFind.
    1717  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code
    1818  12 Jul 09 GKY Add xDosQueryAppType and xDosAlloc... to allow FM/2 to load in high memory
     
    2020  17 Sep 11 GKY Fix commandline quoting issues
    2121  01 Mar 14 JBS Ticket #524: Made "searchapath" thread-safe. Function names and signatures were changed.
    22                 So calls to these functions had to be changed.
     22                So calls to these functions had to be changed.
     23  21 Mar 14 SHL Add IsAbsolutePath
    2324
    2425***********************************************************************/
     
    2627#include <stdlib.h>
    2728#include <string.h>
     29#include <ctype.h>
    2830
    2931#define INCL_WIN
     
    140142  }
    141143  return pszQuotedFileName;
     144}
     145
     146/**
     147 * Return TRUE if absolute path name
     148 * @param pszPathName points to path name
     149 * @returns TRUE if absolute path, with or without drive letter
     150 * @note Odd inputs return FALSE
     151 *
     152 */
     153
     154BOOL IsAbsolutePath(PCSZ pszPathName)
     155{
     156  return pszPathName &&
     157         pszPathName[0] &&
     158         ((pszPathName[0] == '\\' || pszPathName[0] == '/') ||
     159          (toupper(pszPathName[0]) >= 'A' &&
     160           toupper(pszPathName[0]) <= 'Z' &&
     161           pszPathName[1] &&
     162           pszPathName[1] == ':' &&
     163           (pszPathName[2] == '\\' || pszPathName[2] == '/')));
    142164}
    143165
     
    211233               pszCmdLine_);
    212234      if (!offsetexe && !offsetcom) {
    213         if (!SearchPathForFile(PCSZ_PATH, szCmdLine, NULL))
    214           ret = 0;
     235        if (!SearchPathForFile(PCSZ_PATH, szCmdLine, NULL))
     236          ret = 0;
    215237      }
    216238      else
     
    410432#pragma alloc_text(PATHUTIL,BldQuotedFullPathName)
    411433#pragma alloc_text(PATHUTIL,NormalizeCmdLine)
     434#pragma alloc_text(PATHUTIL,IsAbsolutePath)
Note: See TracChangeset for help on using the changeset viewer.