#endif
mode = (cmdentry.u.index == EXECCMD)? 0 : REDIR_PUSH;
if (flags == EV_BACKCMD) {
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+ openmemout();
+#else
memout.nleft = 0;
if (cmdentry.u.index != EXECCMD)
popredir();
if (flags == EV_BACKCMD) {
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+ closememout();
+#endif
backcmd->buf = memout.buf;
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+ backcmd->nleft = memout.bufsize;
+#else
backcmd->nleft = memout.nextc - memout.buf;
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+#undef CEOF /* get rid of the redefine warning */
+#include <fcntl.h>
+#endif
#define OUTPUT_ERR 01 /* error occurred on output */
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+struct output output = {NULL, NULL, 0, NULL, 0, 1, 0};
+struct output errout = {NULL, NULL, 0, NULL, 0, 2, 0};
+struct output memout = {NULL, NULL, 0, NULL, 0, MEM_OUT, 0};
INCLUDE "memalloc.h"
+INIT {
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+ initstreams();
+#endif
+}
RESET {
out1 = &output;
out2 = &errout;
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+ if (memout.stream != NULL)
+ closememout();
+#endif
const char *p;
struct output *file;
{
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+ fputs(p, file->stream);
+#else
while (*p)
}
-+#ifndef _GNU_SOURCE
++#if !defined(_GNU_SOURCE) || defined(__UCLIBC__)
char out_junk[16];
}
-+#ifndef _GNU_SOURCE
++#if !defined(_GNU_SOURCE) || defined(__UCLIBC__)
void
flushout(dest)
struct output *dest;
va_end(ap);
}
-+#ifndef __GLIBC__
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
void
#ifdef __STDC__
dprintf(const char *fmt, ...)
#endif
{
va_list ap;
-+#ifndef _GNU_SOURCE
++#if !defined(_GNU_SOURCE) || defined(__UCLIBC__)
struct output strout;
+#endif
#ifndef __STDC__
#else
va_start(ap, fmt);
#endif
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+ vsnprintf(outbuf, length, fmt, ap);
+#else
strout.nextc = outbuf;
+#endif
}
-+#ifndef _GNU_SOURCE
++#if !defined(_GNU_SOURCE) || defined(__UCLIBC__)
/*
* Formatted output. This routine handles a subset of the printf formats:
* - Formats supported: d, u, o, p, X, s, and c.
+#endif
+
+
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+void initstreams() {
+ output.stream = stdout;
+ errout.stream = stderr;
#else
#include <varargs.h>
#endif
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+#include <stdio.h>
+#endif
struct output {
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+ FILE *stream;
+#endif
char *nextc;
__attribute__((__format__(__printf__,2,3)));
void out1fmt __P((const char *, ...))
__attribute__((__format__(__printf__,1,2)));
-+#ifndef __GLIBC__
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
void dprintf __P((const char *, ...))
__attribute__((__format__(__printf__,1,2)));
+#endif
-int xioctl __P((int, unsigned long, char *));
+#endif
+int xwrite __P((int, const char *, int));
-+#ifdef _GNU_SOURCE
++#if defined(_GNU_SOURCE) && !defined(__UCLIBC__)
+void initstreams __P((void));
+void openmemout __P((void));
+void closememout __P((void));