Changeset 1919


Ignore:
Timestamp:
Nov 11, 2025, 5:42:02 PM (9 hours ago)
Author:
Gregg Young
Message:

Fix issue with command lines that contain 2 (or more) executable extentions Ticket #536

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/pathutil.c

    r1880 r1919  
    4848#include "stristr.h"                    //stristr
    4949
     50#ifdef PMPRINTF
     51#define  _PMPRINTF_                     // Enable debug macros
     52#include "PMPRINTF.H"
     53#endif
     54
    5055static PSZ pszSrcFile = __FILE__;
    5156
     
    200205    offsetbat = stristr(pszCmdLine_, PCSZ_DOTBAT);
    201206    if (offsetexe)
    202       offset = offsetexe;
    203     else {
    204       if (offsetcom)
    205         offset = offsetcom;
    206       else {
    207         if (offsetcmd)
    208           offset = offsetcmd;
    209         else {
    210           if (offsetbtm)
    211             offset = offsetbtm;
    212           else {
    213             if (offsetbat)
    214               offset = offsetexe;
    215           }
    216         }
     207        offset = offsetexe;
     208    if (offsetcom && !offset)
     209        offset = offsetcom;
     210    else if (offsetcom) {
     211      if (offsetcom < offset) {
     212        offset = offsetcom;
     213        offsetexe = '\0';
     214      }
     215    }
     216    if (offsetcmd && !offset)
     217        offset = offsetcmd;
     218    else if (offsetcmd) {
     219      if (offsetcmd < offset) {
     220        offset = offsetcmd;
     221        offsetcom = offsetexe = '\0';
     222      }
     223    }
     224    if (offsetbtm && !offset)
     225        offset = offsetbtm;
     226    else if (offsetbtm) {
     227      if (offsetbtm < offset) {
     228        offset = offsetbtm;
     229        offsetcom = offsetexe = '\0';
     230      }
     231    }
     232    if (offsetbat && !offset)
     233        offset = offsetbat;
     234    else if (offsetbat) {
     235      if (offsetbat < offset) {
     236        offset = offsetbat;
     237        offsetcom = offsetexe = '\0';
    217238      }
    218239    }
Note: See TracChangeset for help on using the changeset viewer.