summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorJoseph McCullough <[email protected]>2012-08-17 19:51:38 -0500
committerJoseph McCullough <[email protected]>2012-08-17 19:51:38 -0500
commite7b61c65bba6f33d4cc543bc12fa06c9176f41b7 (patch)
tree76291f74c7563e7b4d3f8358fa99786f2264460d /tools
parent618f25bfe2932b0296407a5c1d381273852214b5 (diff)
downloadmruby-e7b61c65bba6f33d4cc543bc12fa06c9176f41b7.tar.gz
mruby-e7b61c65bba6f33d4cc543bc12fa06c9176f41b7.zip
Don't exit if 'exit' or 'quit' are in quote blocks
Diffstat (limited to 'tools')
-rw-r--r--tools/mirb/mirb.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/mirb/mirb.c b/tools/mirb/mirb.c
index 073054b46..c9198917e 100644
--- a/tools/mirb/mirb.c
+++ b/tools/mirb/mirb.c
@@ -182,12 +182,19 @@ main(void)
last_code_line[char_index] = '\0';
if ((strcmp(last_code_line, "quit") == 0) || (strcmp(last_code_line, "exit") == 0)) {
- /*:quit the program */
- break;
+ if (!code_block_open || !parser->sterm){
+ break;
+ }
+ else{
+ /* count the quit/exit commands as strings if in a quote block */
+ strcat(ruby_code, "\n");
+ strcat(ruby_code, last_code_line);
+ }
}
+
else {
if (code_block_open) {
- strcat(ruby_code, "\n");
+ strcat(ruby_code, "\n");
strcat(ruby_code, last_code_line);
}
else {