Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * $Id: printbuf.h,v 1.2 2004/07/21 01:24:33 mclark Exp $ |
| 3 | * |
| 4 | * Copyright Metaparadigm Pte. Ltd. 2004. |
| 5 | * Michael Clark <michael@metaparadigm.com> |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public (LGPL) |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2.1 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details: http://www.gnu.org/ |
| 16 | * |
| 17 | */ |
| 18 | |
| 19 | #ifndef _printbuf_h_ |
| 20 | #define _printbuf_h_ |
| 21 | |
| 22 | struct printbuf { |
| 23 | char *buf; |
| 24 | int bpos; |
| 25 | int size; |
| 26 | }; |
| 27 | |
| 28 | extern struct printbuf* |
| 29 | printbuf_new(); |
| 30 | |
| 31 | extern int |
| 32 | printbuf_memappend(struct printbuf *p, char *buf, int size); |
| 33 | |
| 34 | extern int |
| 35 | sprintbuf(struct printbuf *p, const char *msg, ...); |
| 36 | |
| 37 | extern void |
| 38 | printbuf_reset(struct printbuf *p); |
| 39 | |
| 40 | extern void |
| 41 | printbuf_free(struct printbuf *p); |
| 42 | |
| 43 | #endif |