Changeset 1394 for trunk/dll/pathutil.c
- Timestamp:
- Feb 5, 2009, 5:17:25 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/pathutil.c
r1323 r1394 7 7 8 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2001, 200 8Steven H. Levine9 Copyright (c) 2001, 2009 Steven H. Levine 10 10 11 11 05 Jan 08 SHL Move from arccnrs.c and comp.c to here … … 13 13 29 Feb 08 GKY Changes to enable user settable command line length 14 14 15 Oct 08 GKY Fix NormalizeCmdLine to check all 5 executible extensions when no extension provided; 15 16 15 use searchapath to check for existance of file types not checked by DosQAppType; 16 close DosFind. 17 17 18 18 ***********************************************************************/ … … 98 98 */ 99 99 100 PSZ BldQuotedFileName(PSZ pszQuotedFileName, P SZ pszFileName)100 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PCSZ pszFileName) 101 101 { 102 102 BOOL q = needs_quoting(pszFileName); … … 184 184 pszCmdLine_); 185 185 if (!offsetexe && !offsetcom) { 186 187 188 186 FullPath = searchapath("PATH", szCmdLine); 187 if (*FullPath) 188 ret = 0; 189 189 } 190 190 else … … 193 193 //printf("%d A", ret); fflush(stdout); 194 194 if (ret) { 195 196 197 198 199 200 201 202 203 204 } 205 206 207 208 195 ret = saymsg(MB_YESNO, 196 HWND_DESKTOP, 197 NullStr, 198 GetPString(IDS_PROGRAMNOTFOUNDTEXT), 199 pszCmdLine_); 200 if (ret == MBID_YES){ 201 if (szArgs[0] != ' ') 202 strcat(pszNewCmdLine, " "); 203 strcat(pszNewCmdLine, szArgs); 204 } 205 else{ 206 fCancelAction = TRUE; 207 pszNewCmdLine = pszCmdLine_; 208 } 209 209 } 210 210 else{ 211 212 213 211 if (szArgs[0] != ' ') 212 strcat(pszNewCmdLine, " "); 213 strcat(pszNewCmdLine, szArgs); 214 214 } 215 215 … … 219 219 strrchr(szCmdLine, '.' ) < strrchr(szCmdLine, '\\'))) { 220 220 if (!strchr(szCmdLine, ' ')) { 221 221 // strip quotes readded by BuildQuotedFileName 222 222 while (strchr(szCmdLine, '\"')) 223 223 remove_first_occurence_of_character("\"", szCmdLine); 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 224 ret = DosQueryAppType(szCmdLine, &ulAppType); // exe automatically appended 225 if (!ret) 226 strcat(szCmdLine, ".exe"); 227 else { 228 strcat(szCmdLine, ".com"); 229 ret = DosQueryAppType(szCmdLine, &ulAppType); 230 if (ret) { 231 offset = strrchr(szCmdLine, '.' ); 232 *offset = 0; 233 strcat(szCmdLine, ".cmd"); 234 FullPath = searchapath("PATH", szCmdLine); 235 if (*FullPath) 236 ret = 0; 237 else { 238 *offset = 0; 239 strcat(szCmdLine, ".bat"); 240 FullPath = searchapath("PATH", szCmdLine); 241 if (*FullPath) 242 ret = 0; 243 else { 244 *offset = 0; 245 strcat(szCmdLine, ".bmt"); 246 FullPath = searchapath("PATH", szCmdLine); 247 if (*FullPath) 248 ret = 0; 249 } 250 } 251 } 252 } 253 253 //printf("%d", ret); fflush(stdout); 254 254 } … … 260 260 if (*pszChar == ' ') { //test at every space for the end of the filename 261 261 *pszChar = '\0'; 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 262 ret = DosQueryAppType(szCmdLine, &ulAppType); 263 if (!ret) { 264 strcat(szCmdLine, ".exe"); 265 break; 266 } 267 else { 268 strcat(szCmdLine, ".com"); 269 ret = DosQueryAppType(szCmdLine, &ulAppType); 270 if (ret) { 271 offset = strrchr(szCmdLine, '.' ); 272 *offset = 0; 273 strcat(szCmdLine, ".cmd"); 274 FullPath = searchapath("PATH", szCmdLine); 275 if (*FullPath) { 276 ret = 0; 277 break; 278 } 279 else { 280 *offset = 0; 281 strcat(szCmdLine, ".bat"); 282 FullPath = searchapath("PATH", szCmdLine); 283 if (*FullPath) { 284 ret = 0; 285 break; 286 } 287 else { 288 *offset = 0; 289 strcat(szCmdLine, ".bmt"); 290 FullPath = searchapath("PATH", szCmdLine); 291 if (*FullPath) { 292 ret = 0; 293 break; 294 } 295 } 296 } 297 } 298 else 299 break; 300 } 301 301 //printf("%d %s\n", ret, szCmdLine); fflush(stdout); 302 302 } … … 306 306 } 307 307 if (!ret){ 308 309 310 311 312 313 314 315 316 317 318 319 320 321 308 BldQuotedFileName(pszNewCmdLine, szCmdLine); 309 strcpy(szArgs, pszCmdLine_ + strlen(szCmdLine) - 3); 310 if ((szArgs[0] == '\"' && szArgs[1] == ' ') || 311 !strstr(pszCmdLine_, "\\:" ) || 312 strchr(szArgs, '\"') == strrchr(szArgs, '\"')) 313 remove_first_occurence_of_character("\"", szArgs); 314 if (strchr(szArgs, '\"') != strrchr(szArgs, '\"')) 315 saymsg(MB_OK, HWND_DESKTOP, 316 NullStr, 317 GetPString(IDS_QUOTESINARGSTEXT), 318 pszCmdLine_); 319 if (szArgs[0] != ' ') 320 strcat(pszNewCmdLine, " "); 321 strcat(pszNewCmdLine, szArgs); 322 322 } 323 323 else { // fail if no extension can be found runemf2 requires one 324 325 326 327 328 329 330 324 ret = saymsg(MB_OK, 325 HWND_DESKTOP, 326 NullStr, 327 GetPString(IDS_PROGRAMNOTEXE2TEXT), 328 pszCmdLine_); 329 fCancelAction = TRUE; 330 pszNewCmdLine = pszCmdLine_; 331 331 } 332 332 } … … 359 359 pszCmdLine_); 360 360 if (ret == MBID_YES) { 361 362 363 361 if (szArgs[0] != ' ') 362 strcat(pszNewCmdLine, " "); 363 strcat(pszNewCmdLine, szArgs); 364 364 } 365 365 else { … … 370 370 else { 371 371 ret = saymsg(MB_YESNOCANCEL, 372 373 374 375 376 377 378 379 380 381 382 383 384 372 HWND_DESKTOP, 373 NullStr, 374 GetPString(IDS_PROGRAMNOTEXE3TEXT), 375 pszCmdLine_, pszNewCmdLine); 376 if (ret == MBID_YES){ 377 if (szArgs[0] != ' ') 378 strcat(pszNewCmdLine, " "); 379 strcat(pszNewCmdLine, szArgs); 380 } 381 if (ret == MBID_CANCEL){ 382 fCancelAction = TRUE; 383 pszNewCmdLine = pszCmdLine_; 384 } 385 385 } 386 386 }
Note:
See TracChangeset
for help on using the changeset viewer.