Add the 'read' utility
* geesh/built-ins/read.scm: New file. * Makefile.am: Add it. * geesh/built-ins.scm (*built-ins*): Define 'read'.
This commit is contained in:
parent
2db7833d61
commit
339f59d639
|
@ -38,6 +38,7 @@ test-list: ; @echo $(TESTS)
|
||||||
|
|
||||||
MODULES = \
|
MODULES = \
|
||||||
geesh/built-ins/echo.scm \
|
geesh/built-ins/echo.scm \
|
||||||
|
geesh/built-ins/read.scm \
|
||||||
geesh/built-ins.scm \
|
geesh/built-ins.scm \
|
||||||
geesh/environment.scm \
|
geesh/environment.scm \
|
||||||
geesh/eval.scm \
|
geesh/eval.scm \
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
("kill" . ,undefined)
|
("kill" . ,undefined)
|
||||||
("newgrp" . ,undefined)
|
("newgrp" . ,undefined)
|
||||||
("pwd" . ,undefined)
|
("pwd" . ,undefined)
|
||||||
("read" . ,undefined)
|
("read" . ,(@@ (geesh built-ins read) main))
|
||||||
("true" . ,undefined)
|
("true" . ,undefined)
|
||||||
("umask" . ,undefined)
|
("umask" . ,undefined)
|
||||||
("unalias" . ,undefined)
|
("unalias" . ,undefined)
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
;;; The Geesh Shell Interpreter
|
||||||
|
;;; Copyright 2018 Timothy Sample <samplet@ngyro.com>
|
||||||
|
;;;
|
||||||
|
;;; This file is part of Geesh.
|
||||||
|
;;;
|
||||||
|
;;; Geesh is free software: you can redistribute it and/or modify
|
||||||
|
;;; it under the terms of the GNU General Public License as published by
|
||||||
|
;;; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
;;; (at your option) any later version.
|
||||||
|
;;;
|
||||||
|
;;; Geesh is distributed in the hope that it will be useful,
|
||||||
|
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;;; GNU General Public License for more details.
|
||||||
|
;;;
|
||||||
|
;;; You should have received a copy of the GNU General Public License
|
||||||
|
;;; along with Geesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
(define-module (geesh built-ins read)
|
||||||
|
#:use-module (geesh environment)
|
||||||
|
#:use-module (ice-9 rdelim))
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
;;;
|
||||||
|
;;; The 'read' utility.
|
||||||
|
;;;
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(define (main env . args)
|
||||||
|
(set-var! env (car args) (read-line (current-input-port)))
|
||||||
|
0)
|
Loading…
Reference in New Issue