* Added a --script option to ikarus. If --script is passed as an

argument, then the greeting is suppressed and no cafe is entered.

* Example 1 (non-script): script.ss contains
     #!/usr/bin/ikarus
     (display "Hello Script\n")
   
     $ ./script.ss
     Ikarus Scheme (Build 2006-12-02)
     Copyright (c) 2006 Abdulaziz Ghuloum
     
     Hello Script
     > 
  
* Example 2 (script): script.ss contains
     #!/usr/bin/ikarus --script
     (display "Hello Script\n")
   
     $ ./script.ss
     Hello Script
     $
This commit is contained in:
Abdulaziz Ghuloum 2006-12-02 05:28:11 -05:00
parent 23ff529aa2
commit cfc1fcdb37
3 changed files with 18 additions and 11 deletions

Binary file not shown.

View File

@ -54,20 +54,28 @@
(putprop '|#system| '*sc-expander* sysmod)
(putprop 'scheme '*sc-expander* schmod))))
(let-values ([(files args)
(let-values ([(files script? args)
(let f ([args (command-line-arguments)])
(cond
[(null? args) (values '() '())]
[(null? args) (values '() #f '())]
[(string=? (car args) "--")
(values '() (cdr args))]
(values '() #f (cdr args))]
[(string=? (car args) "--script")
(let-values ([(f* _ a*) (f (cdr args))])
(values f* #t a*))]
[else
(let-values ([(f* a*) (f (cdr args))])
(values (cons (car args) f*) a*))]))])
(let-values ([(f* script? a*) (f (cdr args))])
(values (cons (car args) f*) script? a*))]))])
(current-eval compile)
(command-line-arguments args)
(printf "Ikarus Scheme (Build ~a)\n" (compile-time-date-string))
(display "Copyright (c) 2006 Abdulaziz Ghuloum\n\n")
(for-each load files)
(new-cafe))
(cond
[script? ; no greeting, no cafe
(for-each load files)
(exit 0)]
[else
(printf "Ikarus Scheme (Build ~a)\n" (compile-time-date-string))
(display "Copyright (c) 2006 Abdulaziz Ghuloum\n\n")
(for-each load files)
(new-cafe)]))

View File

@ -486,9 +486,8 @@
(make-parameter
(lambda args
(apply print-error args)
(display "exiting\n" (console-output-port))
(flush-output-port (console-output-port))
(exit -100))
(exit -1))
(lambda (x)
(if (procedure? x)
x