2 Copyright (C) 1995-2016, The AROS Development Team. All rights reserved.
11 LONG
convertRedir(ShellState
*ss
, Buffer
*in
, Buffer
*out
)
13 STRPTR s
= in
->buf
+ in
->cur
;
14 BOOL newIn
= FALSE
, newOut
= FALSE
;
20 if (ss
->newIn
) /* multiple < not allowed */
21 return ERROR_TOO_MANY_LEVELS
;
23 newIn
= TRUE
; /* new input */
29 if (ss
->newOut
) /* multiple > or >> not allowed */
30 return ERROR_TOO_MANY_LEVELS
;
38 newOut
= TRUE
; /* new output */
41 in
->cur
= s
- in
->buf
;
43 switch (bufferReadItem(file
, FILE_MAX
, in
, DOSBase
))
49 return ERROR_LINE_TOO_LONG
;
54 if (!(ss
->newIn
= Open(file
, MODE_OLDFILE
)))
57 ss
->oldIn
= SelectInput(ss
->newIn
);
62 LONG mode
= append
? MODE_READWRITE
: MODE_NEWFILE
;
64 if (!(ss
->newOut
= Open(file
, mode
)))
67 if (append
&& Seek(ss
->newOut
, 0, OFFSET_END
) == -1)
70 ss
->oldOut
= SelectOutput(ss
->newOut
);