Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of "exit" and "quit" in mirb. #434

Merged
merged 2 commits into from Aug 18, 2012
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
@@ -181,23 +181,20 @@ main(void)

last_code_line[char_index] = '\0';

if ((strcmp(last_code_line, "quit") == 0) ||
(strcmp(last_code_line, "exit") == 0)) {
if (code_block_open) {
/* cancel the current block and reset */
code_block_open = FALSE;
memset(ruby_code, 0, sizeof(*ruby_code));
memset(last_code_line, 0, sizeof(*last_code_line));
continue;
}
else {
/* quit the program */
if ((strcmp(last_code_line, "quit") == 0) || (strcmp(last_code_line, "exit") == 0)) {
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 {