1
0
Fork 0
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:
Werner Koch 1998-02-16 20:05:02 +00:00
parent f477447d9a
commit 82464369f6
45 changed files with 1299 additions and 324 deletions

View file

@ -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