#ifndef BUFFER_H
#define BUFFER_H

#include "sysdep.h"
#include "memory.h"

typedef struct Buffer_str *Buffer;

#ifdef __STDC__
extern Buffer Buffer_create(char *, unsigned);
extern char * Buffer_get_next_chunk(Buffer, int);  
extern NORET  Buffer_destroy_chunk(Buffer, char *);
extern NORET  Buffer_destroy(Buffer);
extern char * Buffer_copy_of_buff(Buffer);
extern NORET  Buffer_append(Buffer,char *);
#else
extern Buffer Buffer_create();
extern char * Buffer_get_next_chunk();
extern NORET  Buffer_destroy_chunk();
extern NORET  Buffer_destroy();
extern char * Buffer_copy_of_buff();
extern NORET  Buffer_append();
#endif

#endif

/***************************************************
  The create function takes a null terminated string and a Chunks
  number which is the amount of memory to allocate when the buffer
  runs out of space.  The buffer is copied.  Each chunck you
  get via get_next_chunk is copied and must be destroyed with the
  appropriate function.  Thew chunks are NOT terminated with the character
  you were chunking to if the chunking character was
  found but theey will be storred in buffers long enough for you to manually
  the terminating NULL with the chunking character and then a NULL.  If the
  EOF  was reached beforehand then all that was encountered up to
  the EOF is returned  
*/
