nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

substdio_copy.c (305B)


      1 #include "substdio.h"
      2 
      3 int substdio_copy(substdio *ssout, substdio *ssin)
      4 {
      5   char *x;
      6 
      7   for (;;) {
      8     ssize_t n;
      9     n = substdio_feed(ssin);
     10     if (n < 0) return -2;
     11     if (!n) return 0;
     12     x = substdio_PEEK(ssin);
     13     if (substdio_put(ssout,x,n) == -1) return -3;
     14     substdio_SEEK(ssin,n);
     15   }
     16 }