Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 1 | /* |
Michael Clark | f6a6e48 | 2007-03-13 08:26:23 +0000 | [diff] [blame^] | 2 | * $Id: printbuf.h,v 1.4 2006/01/26 02:16:28 mclark Exp $ |
Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 3 | * |
Michael Clark | f6a6e48 | 2007-03-13 08:26:23 +0000 | [diff] [blame^] | 4 | * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. |
Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 5 | * Michael Clark <michael@metaparadigm.com> |
| 6 | * |
Michael Clark | f6a6e48 | 2007-03-13 08:26:23 +0000 | [diff] [blame^] | 7 | * This library is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the MIT license. See COPYING for details. |
Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 9 | * |
| 10 | */ |
| 11 | |
| 12 | #ifndef _printbuf_h_ |
| 13 | #define _printbuf_h_ |
| 14 | |
Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 15 | #undef PRINTBUF_DEBUG |
| 16 | |
Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 17 | struct printbuf { |
| 18 | char *buf; |
| 19 | int bpos; |
| 20 | int size; |
| 21 | }; |
| 22 | |
| 23 | extern struct printbuf* |
| 24 | printbuf_new(); |
| 25 | |
| 26 | extern int |
| 27 | printbuf_memappend(struct printbuf *p, char *buf, int size); |
| 28 | |
| 29 | extern int |
| 30 | sprintbuf(struct printbuf *p, const char *msg, ...); |
| 31 | |
| 32 | extern void |
| 33 | printbuf_reset(struct printbuf *p); |
| 34 | |
| 35 | extern void |
| 36 | printbuf_free(struct printbuf *p); |
| 37 | |
| 38 | #endif |