#include <errno.h>
#include <unistd.h>
-#define BUFFER 16*1024*1024
+#ifndef RWBUFFER_SIZE_MB
+#define RWBUFFER_SIZE_MB 16
+#endif
+
+#define BUFFER (RWBUFFER_SIZE_MB*1024*1024)
#define WAITFILL ((BUFFER*3)/4)
static inline int min(int a, int b) { return a<=b ? a : b; }
int main(int argc, const char *const *argv) {
static unsigned char buf[BUFFER];
- if (argv[1]) {
- fputs("readbuffer: no arguments allowed\n", stderr);
- exit(-1);
- }
-
unsigned char *wp, *rp;
int used,r,writing,seeneof;
fd_set readfds;
fd_set writefds;
+ if (argv[1]) {
+ fputs("readbuffer: no arguments allowed\n", stderr);
+ exit(-1);
+ }
+
used=0; wp=rp=buf; writing=0; seeneof=0;
nonblock(0); nonblock(1);
while (!seeneof || used) {