diff options
author | Niall O'Higgins <niallo@cvs.openbsd.org> | 2006-01-10 14:57:54 +0000 |
---|---|---|
committer | Niall O'Higgins <niallo@cvs.openbsd.org> | 2006-01-10 14:57:54 +0000 |
commit | b3904484f76c2679b0f03f6498a073eeec5cd2f0 (patch) | |
tree | dc77230b315f0cc0a5c4aaf12d98682e4ee1d149 /usr.bin/cvs | |
parent | 997e60cfa507c41d6e47ab3a73fec551c786b110 (diff) |
- add cvs_buf_getc() function; returns byte at specified buffer position.
needed for the next commit.
ok xsa@ joris@
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/buf.c | 14 | ||||
-rw-r--r-- | usr.bin/cvs/buf.h | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c index be37ce36b69..8eeb11a4848 100644 --- a/usr.bin/cvs/buf.c +++ b/usr.bin/cvs/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.28 2006/01/02 08:11:56 xsa Exp $ */ +/* $OpenBSD: buf.c,v 1.29 2006/01/10 14:57:53 niallo Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -236,6 +236,18 @@ cvs_buf_putc(BUF *b, int c) } /* + * cvs_buf_getc() + * + * Return u_char at buffer position <pos>. + * + */ +u_char +cvs_buf_getc(BUF *b, u_int pos) +{ + return (b->cb_cur[pos]); +} + +/* * cvs_buf_append() * * Append <len> bytes of data pointed to by <data> to the buffer <b>. If the diff --git a/usr.bin/cvs/buf.h b/usr.bin/cvs/buf.h index b721890696a..f336ccea9c4 100644 --- a/usr.bin/cvs/buf.h +++ b/usr.bin/cvs/buf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.h,v 1.7 2006/01/02 08:11:56 xsa Exp $ */ +/* $OpenBSD: buf.h,v 1.8 2006/01/10 14:57:53 niallo Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -49,6 +49,7 @@ BUF *cvs_buf_alloc(size_t, u_int); BUF *cvs_buf_load(const char *, u_int); void cvs_buf_free(BUF *); void *cvs_buf_release(BUF *); +u_char cvs_buf_getc(BUF *, u_int); void cvs_buf_empty(BUF *); ssize_t cvs_buf_copy(BUF *, size_t, void *, size_t); ssize_t cvs_buf_set(BUF *, const void *, size_t, size_t); |