mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
some import functionality
This commit is contained in:
parent
f477447d9a
commit
82464369f6
45 changed files with 1299 additions and 324 deletions
23
util/iobuf.c
23
util/iobuf.c
|
@ -741,6 +741,29 @@ iobuf_read(IOBUF a, byte *buf, unsigned buflen )
|
|||
}
|
||||
|
||||
|
||||
/****************
|
||||
* Have a look at the iobuf.
|
||||
* NOTE: This does only work in special cases.
|
||||
*/
|
||||
int
|
||||
iobuf_peek(IOBUF a, byte *buf, unsigned buflen )
|
||||
{
|
||||
int n=0;
|
||||
|
||||
if( !(a->d.start < a->d.len) ) {
|
||||
if( underflow(a) == -1 )
|
||||
return -1;
|
||||
/* and unget this character */
|
||||
assert(a->d.start == 1);
|
||||
a->d.start = 0;
|
||||
}
|
||||
|
||||
for(n=0 ; n < buflen && (a->d.start+n) < a->d.len ; n++, buf++ )
|
||||
*buf = a->d.buf[n];
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue