command-line shouldn't include interpreter name (fixes issue #484)

This commit is contained in:
Alex Shinn 2018-12-10 23:44:39 +08:00
parent f0a8930ab4
commit 06c27d81ce
2 changed files with 3 additions and 5 deletions

View file

@ -125,7 +125,7 @@
(let ((args (or (and (pair? o) (car o)) (command-line)))
(config (and (pair? o) (pair? (cdr o)) (cadr o))))
(cond
((parse-app '() (cdr spec) '() (cdr args) config #f #f)
((parse-app '() (cdr spec) '() args config #f #f)
=> (lambda (v)
(let ((proc (vector-ref v 0))
(cfg (vector-ref v 1))
@ -136,11 +136,11 @@
(let ((res (apply proc cfg spec args)))
(if end (end cfg))
res))))
((null? (cdr args))
((null? args)
(app-help spec args)
(error "Expected a command"))
(else
(error "Unknown command" (cdr args))))))
(error "Unknown command" args)))))
;;> Parse a single command-line argument from \var{args} according to
;;> \var{conf-spec}, and returns a list of two values: the

2
main.c
View file

@ -543,8 +543,6 @@ sexp run_main (int argc, char **argv) {
if (i < argc)
for (j=argc-1; j>=i; j--)
args = sexp_cons(ctx, tmp=sexp_c_string(ctx,argv[j],-1), args);
if (i >= argc || main_symbol != NULL)
args = sexp_cons(ctx, tmp=sexp_c_string(ctx,argv[0],-1), args);
load_init(i < argc || main_symbol != NULL);
sexp_set_parameter(ctx, sexp_meta_env(ctx), sym=sexp_intern(ctx, sexp_argv_symbol, -1), args);
if (i >= argc && main_symbol == NULL) {