- Timestamp:
- Mar 22, 2014, 12:29:52 AM (12 years ago)
- Location:
- trunk/dll
- Files:
-
- 3 edited
-
pathutil.c (modified) (6 diffs)
-
pathutil.h (modified) (2 diffs)
-
srchpath.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/pathutil.c
r1750 r1761 14 14 15 Oct 08 GKY Fix NormalizeCmdLine to check all 5 executable extensions when no extension provided; 15 15 use searchapath to check for existance of file types not checked by DosQAppType; 16 close DosFind.16 close DosFind. 17 17 28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code 18 18 12 Jul 09 GKY Add xDosQueryAppType and xDosAlloc... to allow FM/2 to load in high memory … … 20 20 17 Sep 11 GKY Fix commandline quoting issues 21 21 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 23 24 24 25 ***********************************************************************/ … … 26 27 #include <stdlib.h> 27 28 #include <string.h> 29 #include <ctype.h> 28 30 29 31 #define INCL_WIN … … 140 142 } 141 143 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 154 BOOL 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] == '/'))); 142 164 } 143 165 … … 211 233 pszCmdLine_); 212 234 if (!offsetexe && !offsetcom) { 213 if (!SearchPathForFile(PCSZ_PATH, szCmdLine, NULL))214 ret = 0;235 if (!SearchPathForFile(PCSZ_PATH, szCmdLine, NULL)) 236 ret = 0; 215 237 } 216 238 else … … 410 432 #pragma alloc_text(PATHUTIL,BldQuotedFullPathName) 411 433 #pragma alloc_text(PATHUTIL,NormalizeCmdLine) 434 #pragma alloc_text(PATHUTIL,IsAbsolutePath) -
trunk/dll/pathutil.h
r1545 r1761 13 13 28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code. 14 14 23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code 15 21 Mar 14 SHL Add IsAbsolutePath 15 16 16 17 ***********************************************************************/ … … 24 25 #endif 25 26 26 PSZ ForwardslashToBackslash(PSZ pszPathName);27 27 PSZ AddBackslashToPath(PSZ pszPathName); 28 28 29 PSZ BldFullPathName(PSZ pszFullPathName, PCSZ pszPathName, PCSZ pszFileName); 29 30 PSZ BldQuotedFullPathName(PSZ pszFullPathName, PCSZ pszPathName, PCSZ pszFileName); 30 31 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PCSZ pszFileName); 32 33 BOOL IsAbsolutePath(PCSZ pszPathName); 34 PSZ ForwardslashToBackslash(PSZ pszPathName); 35 31 36 PCSZ NormalizeCmdLine(PSZ pszWorkBuf, PSZ pszCmdLine_); 32 37 -
trunk/dll/srchpath.c
r1750 r1761 15 15 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *. 16 16 01 Mar 14 JBS Ticket #524: Made "searchapath" thread-safe. Function names and signatures were changed. 17 21 Mar 14 SHL SearchPathForFile: use IsAbsolutePath 17 18 18 19 ***********************************************************************/ … … 106 107 * SearchPathForFile: Search for a file along a path 107 108 * 108 * @param p Pathname: the name of a path environment variable (input)109 * Used only if pFilename has no directory separators or ':' for a drive sepcification109 * @param pszEnvVarName: the name of a path environment variable (input) 110 * Used only if pFilename has not an absoluate path 110 111 * 111 112 * @param pFilename: the name of a file to search for (input) 112 * If the file name i ncludes a directory separator or the ':' for a drive specificationthen113 * If the file name is an absolute path then 113 114 * DosQueryPathInfo is used for the search 114 115 * else 115 * DosSearchPath is used, along with the p Pathname parameter116 * DosSearchPath is used, along with the pszEnvVarName parameter 116 117 * 117 118 * @param pFullFilename: address of where to place fully-qulified name if search succeeds (output) … … 121 122 * 122 123 */ 123 APIRET SearchPathForFile(PCSZ p Pathname,124 APIRET SearchPathForFile(PCSZ pszEnvVarName, 124 125 PCSZ pFilename, 125 126 PCHAR pFullFilename) … … 128 129 CHAR szFullFilename[CCHMAXPATH]; 129 130 130 if (!p Pathname || !*pPathname || !pFilename || !*pFilename)131 if (!pszEnvVarName || !*pszEnvVarName || !pFilename || !*pFilename) 131 132 return ERROR_INVALID_PARAMETER; 132 133 133 if (strchr(pFilename, '\\') || strchr(pFilename, '/') 134 || strchr(pFilename, ':')) { 134 if (IsAbsolutePath(pFilename)) { 135 135 rc = DosQueryPathInfo(pFilename, FIL_QUERYFULLNAME, 136 (PVOID)szFullFilename, (ULONG) CCHMAXPATH-1);136 (PVOID)szFullFilename, (ULONG)CCHMAXPATH-1); 137 137 } 138 138 else { 139 139 rc = DosSearchPath(SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | 140 140 SEARCH_CUR_DIRECTORY, 141 (CHAR *) p Pathname,141 (CHAR *) pszEnvVarName, 142 142 (CHAR *) pFilename, 143 143 (PBYTE) szFullFilename, 144 144 CCHMAXPATH - 1); 145 145 } 146 if (!rc && pFullFilename) {146 if (!rc && pFullFilename) 147 147 strcpy(pFullFilename, szFullFilename); 148 } 148 149 149 return rc; 150 150 }
Note:
See TracChangeset
for help on using the changeset viewer.
