fix the second bug for 1>text.txt pipe
Modified: trunk/reactos/subsys/system/cmd/redir.c
_____
Modified: trunk/reactos/subsys/system/cmd/redir.c
--- trunk/reactos/subsys/system/cmd/redir.c 2005-07-14 20:26:37 UTC
(rev 16566)
+++ trunk/reactos/subsys/system/cmd/redir.c 2005-07-14 20:51:39 UTC
(rev 16567)
@@ -128,13 +128,57 @@
*ofn++ = *sp++;
*ofn = _T('\0');
}
- else if ((*sp == _T('1')) || (*sp == _T('2')))
+
+ else if (*sp == _T('1'))
{
/* error redirection */
sp++;
if (*sp == _T('>'))
{
+ /* output redirection */
+ *lpnFlags |= OUTPUT_REDIRECTION;
+ sp++;
+
+ /* append request ? */
+ if (*sp == _T('>'))
+ {
+ *lpnFlags |= OUTPUT_APPEND;
+ sp++;
+ }
+
+ while (_istspace (*sp))
+ sp++;
+
+ /* copy file name */
+ while (*sp && !IsRedirection (*sp) &&
!_istspace (*sp))
+ *ofn++ = *sp++;
+ *ofn = _T('\0');
+ }
+ else
+ {
+ /* no redirection!! copy the '1'
character! */
+ sp--;
+ *dp++ = *sp++;
+ continue;
+ }
+
+ while (_istspace (*sp))
+ sp++;
+
+ /* copy file name */
+ while (*sp && !IsRedirection (*sp) &&
!_istspace (*sp))
+ *efn++ = *sp++;
+ *efn = _T('\0');
+ }
+
+ else if (*sp == _T('2'))
+ {
+ /* error redirection */
+ sp++;
+
+ if (*sp == _T('>'))
+ {
*lpnFlags |= ERROR_REDIRECTION;
sp++;
@@ -147,7 +191,7 @@
}
else
{
- /* no redirection!! copy the '1'
or '2' character! */
+ /* no redirection!! copy the '2'
character! */
sp--;
*dp++ = *sp++;
continue;