summaryrefslogtreecommitdiff
path: root/scsh-process.scm
diff options
context:
space:
mode:
authorPeter Bex <peter@more-magic.net>2012-10-01 20:38:00 +0100
committerPeter Bex <peter@more-magic.net>2012-10-01 20:38:00 +0100
commit4d6a0700a6f38f8ca26fa47cfa2e68015bfbd9cc (patch)
tree9862deb7c08a148b6836386fb8851bd8803c90b1 /scsh-process.scm
parentb7e6e25195ecef9c37c21173acc9cf2c355dd6e8 (diff)
downloadscsh-process-4d6a0700a6f38f8ca26fa47cfa2e68015bfbd9cc.tar.gz
Implement appending to files
Diffstat (limited to 'scsh-process.scm')
-rw-r--r--scsh-process.scm17
1 files changed, 10 insertions, 7 deletions
diff --git a/scsh-process.scm b/scsh-process.scm
index 6102c4d..57a773e 100644
--- a/scsh-process.scm
+++ b/scsh-process.scm
@@ -214,19 +214,22 @@
(define-syntax setup-redirection
(syntax-rules (< > << >> = - stdports)
((_ (< ?file-name)) (setup-redirection (< 0 ?file-name)))
- ((_ (> ?file-name)) (setup-redirection (> 1 ?file-name)))
((_ (<< ?object)) (setup-redirection (<< 0 ?object)))
- ((_ (>> ?object)) (setup-redirection (>> 1 ?object)))
- ((_ (< ?fd ?file-name))
- (duplicate-fileno (file-open (maybe-symbol->string `?file-name)
- open/rdonly)
- `?fd))
+ ((_ (> ?file-name)) (setup-redirection (> 1 ?file-name)))
+ ((_ (>> ?file-name)) (setup-redirection (>> 1 ?file-name)))
((_ (> ?fd ?file-name))
(duplicate-fileno (file-open (maybe-symbol->string `?file-name)
(fx+ open/wronly open/creat))
`?fd))
+ ((_ (>> ?fd ?file-name))
+ (duplicate-fileno (file-open (maybe-symbol->string `?file-name)
+ (fx+ open/wronly (fx+ open/append open/creat)))
+ `?fd))
+ ((_ (< ?fd ?file-name))
+ (duplicate-fileno (file-open (maybe-symbol->string `?file-name)
+ open/rdonly)
+ `?fd))
((_ (<< ?fd ?object)) (error "<< currently not implemented"))
- ((_ (>> ?fd ?object)) (error ">> currently not implemented"))
((_ (= ?fd-from ?fd/port-to))
(let* ((fd/port-to ?fd/port-to) ; Evaluate once
(fd-to (if (port? fd/port-to)