Commit e26bf08e authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

tools/mruby: multiple -e should concatenate command line args

parent 140b9cad
...@@ -82,7 +82,14 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args) ...@@ -82,7 +82,14 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
} }
} }
else if (cmdline) { else if (cmdline) {
args->cmdline = strdup(*argv); if (!args->cmdline) {
args->cmdline = strdup(argv[0]);
}
else {
args->cmdline = mrb_realloc(mrb, args->cmdline, strlen(args->cmdline)+strlen(argv[0])+2);
strcat(args->cmdline, "\n");
strcat(args->cmdline, argv[0]);
}
} }
else if (args->rfp == NULL) { else if (args->rfp == NULL) {
if ((args->rfp = fopen(*argv, args->mrbfile ? "rb" : "r")) == NULL) { if ((args->rfp = fopen(*argv, args->mrbfile ? "rb" : "r")) == NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment