Skip to content

Commit 86e67c4

Browse files
committed
support /M[0|1|2] switch
/M2 means enable also extctl option.
1 parent c816336 commit 86e67c4

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

src/command.c

+28-7
Original file line numberDiff line numberDiff line change
@@ -4425,9 +4425,6 @@ int main(int argc, const char *argv[], const char *envp[])
44254425
setenv("COMCOM_VER", version, 1);
44264426
setenv("ERRORLEVEL", "0", 1);
44274427

4428-
if ((v = getenv("COMCOM_MOUSE")) && v[0] == '1')
4429-
mouse_en = mouse_init();
4430-
44314428
// process arguments
44324429
for (a = 1; a < argc; a++)
44334430
{
@@ -4464,11 +4461,28 @@ int main(int argc, const char *argv[], const char *envp[])
44644461
stepping = 1;
44654462
}
44664463

4467-
if (stricmp(argv[a], "/M") == 0 && !mouse_en)
4464+
if (strnicmp(argv[a], "/M", 2) == 0)
44684465
{
4469-
mouse_en = mouse_init();
4470-
if (mouse_en)
4471-
setenv("COMCOM_MOUSE", "1", 1);
4466+
int opt = 1;
4467+
char copt[2];
4468+
if (isdigit(argv[a][2]))
4469+
opt = argv[a][2] - '0';
4470+
copt[0] = opt + '0';
4471+
copt[1] = '\0';
4472+
unsetenv("COMCOM_MOUSE");
4473+
switch (opt)
4474+
{
4475+
case 0:
4476+
break;
4477+
default:
4478+
mouse_en = mouse_init();
4479+
if (mouse_en)
4480+
{
4481+
mouseopt_extctl = (opt == 2);
4482+
setenv("COMCOM_MOUSE", copt, 1);
4483+
}
4484+
break;
4485+
}
44724486
}
44734487

44744488
// check for command in arguments
@@ -4514,6 +4528,13 @@ int main(int argc, const char *argv[], const char *envp[])
45144528
#endif
45154529
}
45164530

4531+
if (!mouse_en && (v = getenv("COMCOM_MOUSE")) && v[0] >= '1')
4532+
{
4533+
mouse_en = mouse_init();
4534+
if (mouse_en && v[0] == '2')
4535+
mouseopt_extctl = 1;
4536+
}
4537+
45174538
if (shell_permanent && !disable_autoexec)
45184539
{
45194540
unsigned int drive;

0 commit comments

Comments
 (0)