diff options
| author | Werner Koch <[email protected]> | 1998-02-16 20:05:02 +0000 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 1998-02-16 20:05:02 +0000 |
| commit | 82464369f664f821542c416d35d4013f9723f87a (patch) | |
| tree | d127f2d891260ff1c6d4264630b2ba7bd463b1f4 /util/iobuf.c | |
| parent | added option export (diff) | |
| download | gnupg-82464369f664f821542c416d35d4013f9723f87a.tar.gz gnupg-82464369f664f821542c416d35d4013f9723f87a.zip | |
some import functionality
Diffstat (limited to 'util/iobuf.c')
| -rw-r--r-- | util/iobuf.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/util/iobuf.c b/util/iobuf.c index cc3288d7e..5815cb538 100644 --- a/util/iobuf.c +++ b/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 |
