utils: Remove unneeded 'stdin->string' procedure.
* src/mcron/utils.scm: Re-export 'read-string'. (stdin->string): Delete. * src/mcron/scripts/crontab.scm (main): Use 'read-string' instead. * src/mcron/scripts/mcron.scm (process-user-file): Likewise.
This commit is contained in:
parent
2d6c072b47
commit
d4b4ac5708
3 changed files with 4 additions and 10 deletions
|
|
@ -210,7 +210,7 @@
|
||||||
(let ((input-file (car (option-ref opts '() '()))))
|
(let ((input-file (car (option-ref opts '() '()))))
|
||||||
(catch-mcron-error
|
(catch-mcron-error
|
||||||
(if (string=? input-file "-")
|
(if (string=? input-file "-")
|
||||||
(let ((input-string (stdin->string)))
|
(let ((input-string (read-string)))
|
||||||
(read-vixie-port (open-input-string input-string))
|
(read-vixie-port (open-input-string input-string))
|
||||||
(with-output-to-file crontab-file
|
(with-output-to-file crontab-file
|
||||||
(λ () (display input-string))))
|
(λ () (display input-string))))
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ silently ignored."
|
||||||
(cond ((string=? "-" file-name)
|
(cond ((string=? "-" file-name)
|
||||||
(if (string=? input "vixie")
|
(if (string=? input "vixie")
|
||||||
(read-vixie-port (current-input-port))
|
(read-vixie-port (current-input-port))
|
||||||
(eval-string (stdin->string))))
|
(eval-string (read-string))))
|
||||||
((or guile-syntax? (regexp-exec guile-regexp file-name))
|
((or guile-syntax? (regexp-exec guile-regexp file-name))
|
||||||
(load file-name))
|
(load file-name))
|
||||||
((regexp-exec vixie-regexp file-name)
|
((regexp-exec vixie-regexp file-name)
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,10 @@
|
||||||
parse-args
|
parse-args
|
||||||
show-version
|
show-version
|
||||||
show-package-information
|
show-package-information
|
||||||
stdin->string
|
|
||||||
for-each-file
|
for-each-file
|
||||||
process-update-request)
|
process-update-request)
|
||||||
#:re-export (option-ref))
|
#:re-export (option-ref
|
||||||
|
read-string))
|
||||||
|
|
||||||
(define (mcron-error exit-code . rest)
|
(define (mcron-error exit-code . rest)
|
||||||
"Print an error message (made up from the parts of REST), and if the
|
"Print an error message (made up from the parts of REST), and if the
|
||||||
|
|
@ -81,12 +81,6 @@ General help using GNU software: <http://www.gnu.org/gethelp/>\n"
|
||||||
config-package-name
|
config-package-name
|
||||||
config-package-url))
|
config-package-url))
|
||||||
|
|
||||||
(define (stdin->string)
|
|
||||||
"Return standard input as a string."
|
|
||||||
(with-output-to-string (lambda () (do ((in (read-char) (read-char)))
|
|
||||||
((eof-object? in))
|
|
||||||
(display in)))))
|
|
||||||
|
|
||||||
(define (for-each-file proc directory)
|
(define (for-each-file proc directory)
|
||||||
"Apply PROC to each file in DIRECTORY. DIRECTORY must be a valid directory name.
|
"Apply PROC to each file in DIRECTORY. DIRECTORY must be a valid directory name.
|
||||||
PROC must be a procedure that take one file name argument. The return value
|
PROC must be a procedure that take one file name argument. The return value
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue