From 7f67b468a3915c868e81486a23ab124c1f1d56e1 Mon Sep 17 00:00:00 2001 From: Stas Sergeev Date: Mon, 5 Feb 2024 19:48:19 +0500 Subject: [PATCH] dont abort bat file on external errors [fixes #85] Like if directory is missing on cd, etc. Abort only on syntax errors. --- src/command.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/command.c b/src/command.c index 24089d9..45b8478 100644 --- a/src/command.c +++ b/src/command.c @@ -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; } } @@ -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; } @@ -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; } } @@ -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) @@ -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) @@ -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 @@ -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; } } @@ -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; } } @@ -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 @@ -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; } } @@ -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; } } @@ -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(); } }