Skip to content

Commit

Permalink
Default mujs shell to non-strict mode.
Browse files Browse the repository at this point in the history
Pass "-s" as the first argument to start the shell in strict mode.
  • Loading branch information
ccxvii committed Aug 29, 2018
1 parent 3430d9a commit 643d428
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,16 @@ main(int argc, char **argv)
{
char *input;
js_State *J;
int i, status = 0;
int status = 0;
int flags = 0;
int i = 1;

J = js_newstate(NULL, NULL, JS_STRICT);
if (i < argc && !strcmp(argv[i], "-s")) {
flags |= JS_STRICT;
++i;
}

J = js_newstate(NULL, NULL, flags);

js_newcfunction(J, jsB_gc, "gc", 0);
js_setglobal(J, "gc");
Expand All @@ -236,10 +243,12 @@ main(int argc, char **argv)
js_dostring(J, require_js);
js_dostring(J, stacktrace_js);

if (argc > 1) {
for (i = 1; i < argc; ++i)
if (i < argc) {
while (i < argc) {
if (js_dofile(J, argv[i]))
status = 1;
++i;
}
} else {
if (isatty(0)) {
using_history();
Expand Down

0 comments on commit 643d428

Please sign in to comment.