/*

Hi,

There is no "initialize this sam" function to call.

Just include the file then you can do things like 


{
	astr *name = NULL;
	
	name = new_astr();
	astr_makestr(name, "Bob %s", "LastName");
	printf("%s", name->str);
	free_astr(&name);
}


*/


#ifndef astr_functions
#define astr_functions

    typedef struct astr{
        char *str;
        int strlen;
        int max_size;
        int pos;
    }astr;


    void free_astr_buffers(void);
    // Call to tidy up any loose ends and free any non used malloced memory.

    astr *new_astr(void);
    // returns a pointer to a new astr.

    astr *astr_strdup(char *copy_from);
    // returns a pointer to a new astr, with copy of "copy_from".

    astr *astr_load_file(char *buff);
    // returns a pointer to a new astr, with copy of file contents.

    void free_astr(astr **fstr_ptr);
    // free that pointer

    void astr_ncopy(astr *fstr, char *str, int n);
    void astr_ncopy_append(astr *fstr, char *str, int n);
    void astr_char_append(astr *firststr, char c);
    void astr_makestr_append(astr *firststr, char * arg_list, ...);
    void astr_makestr(astr *firststr, char * arg_list, ...);


    // NON astr functions, just uses malloced memory only!!!

    char *c_stristr(char *src, char *find);    // case insensitive strstr command
    void removeCR(char *str);                  // overwrite Carrige return with null char.
    char *makestr(char *arg_list, ...);   //returns pointer to malloced vsnprintf'd string
    char *makestr_concat(char *firststr, char * arg_list, ...); // FREES firststr after prepending it to the makestr.
    char *load_file(char *file);        // returns NULL if no file
    char *load_file_e(char *file);      // returns empty string if no file
    int save_file(char *file, char *content); // returns TRUE if saved, FALSE if not.

#endif
