summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-03-23 16:42:54 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-03-23 17:28:48 +0100
commit0b8afc999bba998d56989933e9438137242d6685 (patch)
tree2dad5c4b9f8a0c956ae4b7c2afdd5500c61d00ad /source
parentecc0d30be8e7ffaa55aac38bbec1aa6bb7aae96b (diff)
downloadmupdf-0b8afc999bba998d56989933e9438137242d6685.tar.xz
js: Create 'argv' global containing arguments passed to mutool run.
Diffstat (limited to 'source')
-rw-r--r--source/tools/murun.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c
index 8aa4426a..b7e328e7 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -3152,9 +3152,14 @@ int murun_main(int argc, char **argv)
"a[4] * b[1] + a[5] * b[3] + b[5]];}");
if (argc > 1) {
- for (i = 1; i < argc; ++i)
- if (js_dofile(J, argv[i]))
- return 1;
+ js_newarray(J);
+ for (i = 1; i < argc; ++i) {
+ js_pushstring(J, argv[i]);
+ js_setindex(J, -2, i - 1);
+ }
+ js_setglobal(J, "argv");
+ if (js_dofile(J, argv[1]))
+ return 1;
} else {
char line[256];
fputs(PS1, stdout);