From 6511c4d178cc7bef260cafecf07e874d334d0ed6 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Wed, 17 Jun 2015 16:52:29 -0500 Subject: Allow ORS set command to work with spaces in the value Change-Id: I1a61ba7ad5479f8aa31a0c9c18bf228cf32104e9 --- openrecoveryscript.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp index 75686cfcc..cf6f598c5 100644 --- a/openrecoveryscript.cpp +++ b/openrecoveryscript.cpp @@ -309,12 +309,17 @@ int OpenRecoveryScript::run_script_file(void) { gui_print("Unmounted '%s'\n", mount); } else if (strcmp(command, "set") == 0) { // Set value + size_t len = strlen(value); tok = strtok(value, " "); strcpy(value1, tok); - tok = strtok(NULL, " "); - strcpy(value2, tok); - gui_print("Setting '%s' to '%s'\n", value1, value2); - DataManager::SetValue(value1, value2); + if (len > strlen(value1) + 1) { + char *val2 = value + strlen(value1) + 1; + gui_print("Setting '%s' to '%s'\n", value1, val2); + DataManager::SetValue(value1, val2); + } else { + gui_print("Setting '%s' to empty\n", value1); + DataManager::SetValue(value1, ""); + } } else if (strcmp(command, "mkdir") == 0) { // Make directory (recursive) DataManager::SetValue("tw_action_text2", "Making Directory"); -- cgit v1.2.3