=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/buf.c,v retrieving revision 1.42 retrieving revision 1.43 diff -c -r1.42 -r1.43 *** src/usr.bin/cvs/buf.c 2006/04/05 01:38:55 1.42 --- src/usr.bin/cvs/buf.c 2006/04/06 16:48:34 1.43 *************** *** 1,4 **** ! /* $OpenBSD: buf.c,v 1.42 2006/04/05 01:38:55 ray Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: buf.c,v 1.43 2006/04/06 16:48:34 xsa Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau * All rights reserved. *************** *** 164,190 **** } /* - * cvs_buf_copy() - * - * Copy the first bytes of data in the buffer starting at offset - * in the destination buffer , which can accept up to bytes. - * Returns the number of bytes successfully copied, or -1 on failure. - */ - ssize_t - cvs_buf_copy(BUF *b, size_t off, void *dst, size_t len) - { - size_t rc; - - if (off > b->cb_len) - fatal("cvs_buf_copy failed"); - - rc = MIN(len, (b->cb_len - off)); - memcpy(dst, b->cb_buf + off, rc); - - return (ssize_t)rc; - } - - /* * cvs_buf_set() * * Set the contents of the buffer at offset to the first --- 164,169 ---- *************** *** 321,340 **** } /* - * cvs_buf_peek() - * - * Peek at the contents of the buffer at offset . - */ - const void * - cvs_buf_peek(BUF *b, size_t off) - { - if (off >= b->cb_len) - return (NULL); - - return (b->cb_buf + off); - } - - /* * cvs_buf_write_fd() * * Write the contents of the buffer to the specified --- 300,305 ---- *************** *** 444,446 **** --- 409,448 ---- return (ssize_t)b->cb_size; } + + #if !defined(RCSPROG) + /* + * cvs_buf_copy() + * + * Copy the first bytes of data in the buffer starting at offset + * in the destination buffer , which can accept up to bytes. + * Returns the number of bytes successfully copied, or -1 on failure. + */ + ssize_t + cvs_buf_copy(BUF *b, size_t off, void *dst, size_t len) + { + size_t rc; + + if (off > b->cb_len) + fatal("cvs_buf_copy failed"); + + rc = MIN(len, (b->cb_len - off)); + memcpy(dst, b->cb_buf + off, rc); + + return (ssize_t)rc; + } + + /* + * cvs_buf_peek() + * + * Peek at the contents of the buffer at offset . + */ + const void * + cvs_buf_peek(BUF *b, size_t off) + { + if (off >= b->cb_len) + return (NULL); + + return (b->cb_buf + off); + } + #endif /* RCSPROG */