blob: 561379a810db30277641ebbdbc3bf99f452de8a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/* ISC license. */
#include <skalibs/iobuffer.h>
int iobuffer_init (iobuffer_ref b, int fdin, int fdout)
{
if (!iobufferk_init(&b->x.k, fdin, fdout)) goto user ;
if (!iobufferk_isworking(&b->x.k)) goto fk ;
b->isk = 1 ;
return 1 ;
fk:
iobufferk_finish(&b->x.k) ;
user:
if (!iobufferu_init(&b->x.u, fdin, fdout)) return 0 ;
b->isk = 0 ;
return 1 ;
}
|