Commit 616dcccb authored by Erick's avatar Erick

Added the R7RS primitive `command-line`

parent 3940052f
......@@ -18,7 +18,7 @@
;; USA.
;; Author: Erick Gallesio [eg@unice.fr]
;; Creation date: 26-Nov-2000 18:19 (eg)
;; Last file update: 21-Sep-2018 09:38 (eg)
;; Last file update: 21-Sep-2018 09:49 (eg)
;;
;; ======================================================================
......@@ -712,6 +712,7 @@ standard primivitives to acess environment variables.
(insertdoc 'hostname)
(insertdoc 'argc)
(insertdoc 'argv)
(insertdoc 'command-line)
(insertdoc 'program-name)
(insertdoc 'version)
(insertdoc 'machine-type)
......
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 14-Jun-2000 17:24 (eg)
;;;; Last file update: 21-Sep-2018 09:32 (eg)
;;;; Last file update: 21-Sep-2018 09:47 (eg)
;;;;
......@@ -331,6 +331,18 @@ doc>
(define (program-name)
(key-get *%program-args* :program-name))
#|
<doc R7RS command-line
* (command-line)
*
* Returns the command line passed to the process as a list
* of strings. The first string corresponds to the command
* name.
doc>
|#
(define (command-line)
(cons (key-get *%program-args* :program-name)
(key-get *%program-args* :argv '())))
#|
<doc EXT make-directories
......
......@@ -22,7 +22,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 17-Apr-2011 20:58 (eg)
;;;; Last file update: 24-Aug-2018 15:41 (eg)
;;;; Last file update: 21-Sep-2018 10:01 (eg)
;;;;
(require "test")
......@@ -634,5 +634,28 @@
(flush-output-port p)
(get-output-bytevector p)))
;;======================================================================
(test-subsection "System Interface")
(test "command-line"
#t
(pair? (command-line)))
(test "get-enviroment-variables"
#t
(pair? (get-environment-variables)))
(test "get-environment-variable"
#t
(let ((path (get-environment-variable "PATH")))
(if path
(equal? (cdr (assoc "PATH" (get-environment-variables)))
path)
#t)))
(test "current-second" #t (real? (current-second)))
(test "current-jiffy" #t (exact? (current-jiffy)))
(test "jiffies-per-second" #t (exact? (jiffies-per-second)))
(test-section-end)
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