Return to string_fp.h CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / mpd / src / contrib / libpdel / io |
1.1 misho 1: 2: /* 3: * Copyright (c) 2001-2002 Packet Design, LLC. 4: * All rights reserved. 5: * 6: * Subject to the following obligations and disclaimer of warranty, 7: * use and redistribution of this software, in source or object code 8: * forms, with or without modifications are expressly permitted by 9: * Packet Design; provided, however, that: 10: * 11: * (i) Any and all reproductions of the source or object code 12: * must include the copyright notice above and the following 13: * disclaimer of warranties; and 14: * (ii) No rights are granted, in any manner or form, to use 15: * Packet Design trademarks, including the mark "PACKET DESIGN" 16: * on advertising, endorsements, or otherwise except as such 17: * appears in the above copyright notice or in the software. 18: * 19: * THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND 20: * TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO 21: * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING 22: * THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED 23: * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, 24: * OR NON-INFRINGEMENT. PACKET DESIGN DOES NOT WARRANT, GUARANTEE, 25: * OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS 26: * OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, 27: * RELIABILITY OR OTHERWISE. IN NO EVENT SHALL PACKET DESIGN BE 28: * LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE 29: * OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT, 30: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL 31: * DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF 32: * USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF 33: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 35: * THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF 36: * THE POSSIBILITY OF SUCH DAMAGE. 37: * 38: * Author: Archie Cobbs <archie@freebsd.org> 39: */ 40: 41: #ifndef _PDEL_IO_STRING_FP_H_ 42: #define _PDEL_IO_STRING_FP_H_ 43: 44: __BEGIN_DECLS 45: 46: /* 47: * Create an input stream from a buffer. The buffer is copied if copy != 0. 48: * 49: * Returns NULL and sets errno if there was an error. 50: */ 51: extern FILE *string_buf_input(const void *buf, size_t len, int copy); 52: 53: /* 54: * Create a new string output buffer. The string will be allocated 55: * using the supplied memory type (the string is *not* copied). 56: * 57: * Returns NULL and sets errno if there was an error. 58: */ 59: extern FILE *string_buf_output(const char *mtype); 60: 61: /* 62: * Get the current contents of the output buffer of a stream created 63: * with string_buf_output(). 64: * 65: * If 'reset' is true, then the output buffer is reset and the returned 66: * value must be manually free'd (using the same memory type supplied 67: * to string_buf_output); otherwise, it should not be freed or modified. 68: * 69: * In any case, the string is always NUL-terminated. 70: * 71: * Returns NULL and sets errno if there was an error; the stream will 72: * still need to be closed. 73: */ 74: extern char *string_buf_content(FILE *fp, int reset); 75: 76: /* 77: * Get the number of bytes currently in the output buffer 78: * of a stream created with string_buf_output(). 79: */ 80: extern int string_buf_length(FILE *fp); 81: 82: __END_DECLS 83: 84: #endif /* _PDEL_IO_STRING_FP_H_ */ 85: