Skip to content

Commit

Permalink
dont abort bat file on external errors [fixes #85]
Browse files Browse the repository at this point in the history
Like if directory is missing on cd, etc.
Abort only on syntax errors.
  • Loading branch information
stsp committed Feb 5, 2024
1 parent e1e19c4 commit 7f67b46
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,6 @@ static void perform_cd(const char *arg)
if (chdir(arg) != 0)
{
cprintf("Directory does not exist - %s\r\n",arg);
reset_batfile_call_stack();
return;
}
}
Expand All @@ -1860,13 +1859,11 @@ static void perform_change_drive(void)
if (cur_drive != drive_set)
{
cprintf("Invalid drive specification - %s\r\n", cmd);
reset_batfile_call_stack();
return;
}
if (!getcwd(cur_drive_and_path, MAXPATH))
{
cprintf("Drive not ready - %s\r\n", cmd);
reset_batfile_call_stack();
setdrive(old_drive, &dummy);
return;
}
Expand Down Expand Up @@ -2117,7 +2114,6 @@ static void perform_delete(const char *arg)
else
{
cprintf("Access denied - %s\r\n", individual_filespec);
reset_batfile_call_stack();
return;
}
}
Expand Down Expand Up @@ -2276,7 +2272,6 @@ static void perform_deltree(const char *arg)
if (remove(full_path_filespec) != 0)
{
cprintf("Unable to delete file - %s\r\n", full_path_filespec);
reset_batfile_call_stack();
return;
}
if (subdir_level == 0)
Expand All @@ -2302,7 +2297,6 @@ static void perform_deltree(const char *arg)
if (rmdir(full_path_filespec) != 0)
{
cprintf("Unable to remove directory - %s\\\r\n", full_path_filespec);
reset_batfile_call_stack();
return;
}
if (subdir_level == 1)
Expand Down Expand Up @@ -3269,7 +3263,7 @@ static void perform_md(const char *arg)
if (_mkdir(arg) != 0)
{
cprintf("Could not create directory - %s\r\n", arg);
reset_batfile_call_stack();
// reset_batfile_call_stack();
}
}
else
Expand Down Expand Up @@ -3340,7 +3334,6 @@ static void perform_popd(const char *arg)
if (chdir(pushd_stack[--pushd_stack_level]) != 0)
{
cprintf("Directory does not exist - %s\r\n",arg);
reset_batfile_call_stack();
return;
}
}
Expand Down Expand Up @@ -3373,7 +3366,6 @@ static void perform_pushd(const char *arg)
if (chdir(arg) != 0)
{
cprintf("Directory does not exist - %s\r\n",arg);
reset_batfile_call_stack();
return;
}
}
Expand Down Expand Up @@ -3405,7 +3397,6 @@ static void perform_rd(const char *arg)
if (rmdir(arg) != 0)
{
cprintf("Could not remove directory - %s\r\n", arg);
reset_batfile_call_stack();
}
}
else
Expand Down Expand Up @@ -3536,7 +3527,6 @@ static void perform_rename(const char *arg)
else
{
cprintf("Unable to rename %s to %s%s\n", full_from_filespec, new_to_name, new_to_ext);
reset_batfile_call_stack();
return;
}
}
Expand Down Expand Up @@ -3606,7 +3596,6 @@ static void perform_set(const char *arg)
if (err != 0)
{
cprintf("Error setting environment variable - %s\r\n", var_name);
reset_batfile_call_stack();
return;
}
}
Expand Down Expand Up @@ -3737,7 +3726,6 @@ static void perform_type(const char *arg)
else
{
cprintf("Unable to open file - %s\r\n", filespec);
reset_batfile_call_stack();
}
}

Expand Down

0 comments on commit 7f67b46

Please sign in to comment.