@@ -833,7 +833,11 @@
if (iflag && funcline == 0 && argc > 0)
lastarg = nargv[-1];
+#ifdef USE_GLIBC_STDIO
+ preverrout.stream = stderr;
+#else
preverrout.fd = 2;
+#endif
expredir(cmd->ncmd.redirect);
redir_stop = pushredir(cmd->ncmd.redirect);
status = redirectsafe(cmd->ncmd.redirect, REDIR_PUSH|REDIR_SAVEFD2);
@@ -77,7 +77,7 @@
};
struct output errout = {
.stream = 0, .nextc = 0, .end = 0, .buf = 0, .bufsize = 0, .fd = 2, .flags = 0
-}
+};
#ifdef notyet
struct output memout = {
.stream = 0, .nextc = 0, .end = 0, .buf = 0, .bufsize = 0, .fd = MEM_OUT, .flags = 0
@@ -90,13 +90,13 @@
struct output errout = {
.nextc = 0, .end = 0, .buf = 0, .bufsize = 0, .fd = 2, .flags = 0
};
-struct output preverrout;
#ifdef notyet
struct output memout = {
.nextc = 0, .end = 0, .buf = 0, .bufsize = 0, .fd = MEM_OUT, .flags = 0
};
#endif
#endif
+struct output preverrout;
struct output *out1 = &output;
struct output *out2 = &errout;
@@ -215,7 +215,6 @@
}
-#ifndef USE_GLIBC_STDIO
void
@@ -224,7 +223,6 @@
char buf = c;
outmem(&buf, 1, dest);
}
-#endif
void
@@ -378,7 +376,6 @@
}
-#ifdef notyet
#ifdef USE_GLIBC_STDIO
void initstreams() {
output.stream = stdout;
@@ -386,6 +383,7 @@
}
+#ifdef notyet
void
openmemout(void) {
INTOFF;
@@ -65,9 +65,7 @@
void outmem(const char *, size_t, struct output *);
void outstr(const char *, struct output *);
-#ifndef USE_GLIBC_STDIO
void outcslow(int, struct output *);
-#endif
void flushall(void);
void flushout(struct output *);
void outfmt(struct output *, const char *, ...)
@@ -81,13 +79,11 @@
void doformat(struct output *, const char *, va_list);
#endif
int xwrite(int, const void *, size_t);
-#ifdef notyet
#ifdef USE_GLIBC_STDIO
void initstreams(void);
void openmemout(void);
int __closememout(void);
#endif
-#endif
static inline void
freestdout()
@@ -180,7 +180,11 @@
out2 = &memout;
#endif
if (flags & REDIR_SAVEFD2 && sv->renamed[2] >= 0)
+#ifdef USE_GLIBC_STDIO
+ preverrout.stream = fdopen(sv->renamed[2],"a");
+#else
preverrout.fd = sv->renamed[2];
+#endif
}