mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-09-28 19:05:55 +08:00
17 lines
264 B
C
17 lines
264 B
C
#include "buffer.h"
|
|
|
|
int buffer_copy(buffer *bout,buffer *bin)
|
|
{
|
|
int n;
|
|
char *x;
|
|
|
|
for (;;) {
|
|
n = buffer_feed(bin);
|
|
if (n < 0) return -2;
|
|
if (!n) return 0;
|
|
x = buffer_PEEK(bin);
|
|
if (buffer_put(bout,x,n) == -1) return -3;
|
|
buffer_SEEK(bin,n);
|
|
}
|
|
}
|