version 1.17, 2010/09/08 15:13:39 |
version 1.18, 2010/09/08 20:49:11 |
|
|
static void buf_grow(BUF *, size_t); |
static void buf_grow(BUF *, size_t); |
|
|
/* |
/* |
* buf_alloc() |
|
* |
|
* Create a new buffer structure and return a pointer to it. This structure |
* Create a new buffer structure and return a pointer to it. This structure |
* uses dynamically-allocated memory and must be freed with buf_free(), |
* uses dynamically-allocated memory and must be freed with buf_free(), once |
* once the buffer is no longer needed. |
* the buffer is no longer needed. |
*/ |
*/ |
BUF * |
BUF * |
buf_alloc(size_t len) |
buf_alloc(size_t len) |
|
|
} |
} |
|
|
/* |
/* |
* buf_load() |
|
* |
|
* Open the file specified by <path> and load all of its contents into a |
* Open the file specified by <path> and load all of its contents into a |
* buffer. |
* buffer. |
* Returns the loaded buffer on success or NULL on failure. |
* Returns the loaded buffer on success or NULL on failure. |
|
|
} |
} |
|
|
/* |
/* |
* buf_release() |
|
* |
|
* Free the buffer <b>'s structural information but do not free the contents |
* Free the buffer <b>'s structural information but do not free the contents |
* of the buffer. Instead, they are returned and should be freed later using |
* of the buffer. Instead, they are returned and should be freed later using |
* free(). |
* xfree(). |
*/ |
*/ |
void * |
void * |
buf_release(BUF *b) |
buf_release(BUF *b) |
|
|
return (tmp); |
return (tmp); |
} |
} |
|
|
/* |
|
* buf_get() |
|
*/ |
|
u_char * |
u_char * |
buf_get(BUF *b) |
buf_get(BUF *b) |
{ |
{ |
|
|
} |
} |
|
|
/* |
/* |
* buf_empty() |
|
* |
|
* Empty the contents of the buffer <b> and reset pointers. |
* Empty the contents of the buffer <b> and reset pointers. |
*/ |
*/ |
void |
void |
|
|
} |
} |
|
|
/* |
/* |
* buf_putc() |
|
* |
|
* Append a single character <c> to the end of the buffer <b>. |
* Append a single character <c> to the end of the buffer <b>. |
*/ |
*/ |
void |
void |
|
|
} |
} |
|
|
/* |
/* |
* buf_getc() |
|
* |
|
* Return u_char at buffer position <pos>. |
* Return u_char at buffer position <pos>. |
* |
|
*/ |
*/ |
u_char |
u_char |
buf_getc(BUF *b, size_t pos) |
buf_getc(BUF *b, size_t pos) |
|
|
} |
} |
|
|
/* |
/* |
* buf_append() |
|
* |
|
* Append <len> bytes of data pointed to by <data> to the buffer <b>. If the |
* Append <len> bytes of data pointed to by <data> to the buffer <b>. If the |
* buffer is too small to accept all data, it |
* buffer is too small to accept all data, it will get resized to an |
* will get resized to an appropriate size to accept all data. |
* appropriate size to accept all data. |
* Returns the number of bytes successfully appended to the buffer. |
* Returns the number of bytes successfully appended to the buffer. |
*/ |
*/ |
size_t |
size_t |
|
|
return (rlen); |
return (rlen); |
} |
} |
|
|
/* |
|
* buf_fappend() |
|
* |
|
*/ |
|
size_t |
size_t |
buf_fappend(BUF *b, const char *fmt, ...) |
buf_fappend(BUF *b, const char *fmt, ...) |
{ |
{ |
|
|
} |
} |
|
|
/* |
/* |
* buf_len() |
|
* |
|
* Returns the size of the buffer that is being used. |
* Returns the size of the buffer that is being used. |
*/ |
*/ |
size_t |
size_t |
|
|
} |
} |
|
|
/* |
/* |
* buf_write_fd() |
|
* |
|
* Write the contents of the buffer <b> to the specified <fd> |
* Write the contents of the buffer <b> to the specified <fd> |
*/ |
*/ |
int |
int |
|
|
} |
} |
|
|
/* |
/* |
* buf_write() |
|
* |
|
* Write the contents of the buffer <b> to the file whose path is given in |
* Write the contents of the buffer <b> to the file whose path is given in |
* <path>. If the file does not exist, it is created with mode <mode>. |
* <path>. If the file does not exist, it is created with mode <mode>. |
*/ |
*/ |
|
|
} |
} |
|
|
/* |
/* |
* buf_write_stmp() |
|
* |
|
* Write the contents of the buffer <b> to a temporary file whose path is |
* Write the contents of the buffer <b> to a temporary file whose path is |
* specified using <template> (see mkstemp.3). NB. This function will modify |
* specified using <template> (see mkstemp.3). |
* <template>, as per mkstemp |
* NB. This function will modify <template>, as per mkstemp |
*/ |
*/ |
void |
void |
buf_write_stmp(BUF *b, char *template) |
buf_write_stmp(BUF *b, char *template) |
|
|
} |
} |
|
|
/* |
/* |
* buf_grow() |
|
* |
|
* Grow the buffer <b> by <len> bytes. The contents are unchanged by this |
* Grow the buffer <b> by <len> bytes. The contents are unchanged by this |
* operation regardless of the result. |
* operation regardless of the result. |
*/ |
*/ |