Skip to content
Snippets Groups Projects
Commit 773dea80 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Add long names for redirections.

parent c5a58f30
No related branches found
No related tags found
No related merge requests found
...@@ -235,56 +235,85 @@ ...@@ -235,56 +235,85 @@
(r (make-close-redirection old))) (r (make-close-redirection old)))
(c (x) (c (x)
(match x (match x
(`(! ,fd ,pn ,@flags) (f '! fd pn flags)) (`(! ,fd ,pn ,@flags) (c `(:open ,fd ,pn ,@flags)))
(`(- ,fd) (cl fd)) (`(:open ,fd ,pn ,@flags) (f '! fd pn flags))
(`(< ,pn) (c `(< 0 ,pn)))
(`(< ,fd ,pn) (`(- ,fd) (c `(:close ,fd)))
(`(:close ,fd) (cl fd))
(`(< ,@args) (c `(:input ,@args)))
(`(:input ,pn) (c `(:input 0 ,pn)))
(`(:input ,fd ,pn)
(f '< fd pn (f '< fd pn
'(:input :if-does-not-exist :error))) '(:input :if-does-not-exist :error)))
(`(<> ,pn) (c `(<> 0 ,pn)))
(`(<> ,fd ,pn) (`(<> ,@args) (c `(:io ,@args)))
(`(:io ,pn) (c `(:io 0 ,pn)))
(`(:io ,fd ,pn)
(f '<> fd pn (f '<> fd pn
'(:io :if-exists :overwrite :if-does-not-exist :error))) '(:io :if-exists :overwrite :if-does-not-exist :error)))
(`(> ,pn) (c `(> 1 ,pn)))
(`(> ,fd ,pn) (`(> ,@args) (c `(:output ,@args)))
(`(:output ,pn) (c `(:output 1 ,pn)))
(`(:output ,fd ,pn)
(f '> fd pn (f '> fd pn
'(:output :if-exists :error :if-does-not-exist :create))) '(:output :if-exists :error :if-does-not-exist :create)))
(`(>! ,pn) (c `(>! 1 ,pn)))
(`(>! ,fd ,pn) (`(:error-output ,pn) (c `(:output 2 ,pn)))
(`(>! ,@args) (c `(:force-output ,@args)))
(`(:force-output ,pn) (c `(:force-output 1 ,pn)))
(`(:force-output ,fd ,pn)
(f '>! fd pn (f '>! fd pn
'(:output :if-exists :supersede :if-does-not-exist :create))) '(:output :if-exists :supersede :if-does-not-exist :create)))
(`(>> ,pn) (c `(>> 1 ,pn)))
(`(>> ,fd ,pn) (`(>> ,@args) (c `(:append ,@args)))
(`(:append ,pn) (c `(:append 1 ,pn)))
(`(:append ,fd ,pn)
(f '>> fd pn (f '>> fd pn
'(:output :if-exists :append :if-does-not-exist :error))) '(:output :if-exists :append :if-does-not-exist :error)))
(`(>>! ,pn) (c `(>> 1 ,pn)))
(`(>>! ,fd ,pn) (`(>>! ,@args) (c `(:force-append ,@args)))
(`(:force-append ,pn) (c `(:append 1 ,pn)))
(`(:force-append ,fd ,pn)
(f '>>! fd pn (f '>>! fd pn
'(:output :if-exists :append :if-does-not-exist :create))) '(:output :if-exists :append :if-does-not-exist :create)))
(`(<& ,old-fd -)
(`(<& ,@args) (c `(:redirect-input ,@args)))
(`(:redirect-input ,old-fd -)
(cl old-fd)) (cl old-fd))
(`(<& ,new-fd ,old-fd) (`(:redirect-input ,new-fd ,old-fd)
(fd old-fd new-fd)) (fd old-fd new-fd))
(`(>& ,old-fd -) (`(:redirect-input -)
(cl 0))
(`(>& ,@args) (c `(:redirect-output ,@args)))
(`(:redirect-output ,old-fd -)
(cl old-fd)) (cl old-fd))
(`(>& ,new-fd ,old-fd) (`(:redirect-output ,new-fd ,old-fd)
(fd old-fd new-fd)) (fd old-fd new-fd))
(`(<& -) (`(:redirect-output -)
(cl 0))
(`(>& -)
(cl 1)) (cl 1))
(`(>& ,pn) (`(:redirect-output ,pn)
(c `(> 1 ,pn)) (c `(:output 1 ,pn))
(c `(>& 2 1))) (c `(:redirect-output 2 1)))
(`(>&! ,pn)
(c `(>! 1 ,pn)) (`(>&! ,pn) (c `(:force-redirect ,pn)))
(c `(>& 2 1))) (`(:force-redirect ,pn)
(`(>>& ,pn) (c `(:force-output 1 ,pn))
(c `(:redirect-output 2 1)))
(`(>>& ,pn) (c `(:redirect-append ,pn)))
(`(:redirect-append ,pn)
(c `(>> 1 ,pn)) (c `(>> 1 ,pn))
(c `(>& 2 1))) (c `(>& 2 1)))
(`(>>&! ,pn)
(`(>>&! ,pn) (c `(:force-redirect-append ,pn)))
(`(:force-redirect-append ,pn)
(c `(>>! 1 ,pn)) (c `(>>! 1 ,pn))
(c `(>& 2 1))) (c `(>& 2 1)))
(_ (_
(flush-argument c) (flush-argument c)
(parse-command-spec-token c x) (parse-command-spec-token c x)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment