From b3904484f76c2679b0f03f6498a073eeec5cd2f0 Mon Sep 17 00:00:00 2001 From: Niall O'Higgins Date: Tue, 10 Jan 2006 14:57:54 +0000 Subject: - add cvs_buf_getc() function; returns byte at specified buffer position. needed for the next commit. ok xsa@ joris@ --- usr.bin/cvs/buf.c | 14 +++++++++++++- usr.bin/cvs/buf.h | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'usr.bin/cvs') 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 * All rights reserved. @@ -235,6 +235,18 @@ cvs_buf_putc(BUF *b, int c) return (0); } +/* + * cvs_buf_getc() + * + * Return u_char at buffer position . + * + */ +u_char +cvs_buf_getc(BUF *b, u_int pos) +{ + return (b->cb_cur[pos]); +} + /* * cvs_buf_append() * 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 * 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); -- cgit v1.2.3