X-Git-Url: https://git.deb.at/?p=pkg%2Fabook.git;a=blobdiff_plain;f=misc.h;h=d01691bdc60e51848618dbdcb3950590d117cff7;hp=b40a4a1af9ca435186389e469292811af6ded909;hb=7751b3edc145646e6b55e2fda82eb5619fbe0074;hpb=627bebd233fee0136a6ffbef005da3e62a87f99b diff --git a/misc.h b/misc.h index b40a4a1..d01691b 100644 --- a/misc.h +++ b/misc.h @@ -1,6 +1,16 @@ #ifndef _MISC_H #define _MISC_H +typedef struct abook_list_t { + char *data; + struct abook_list_t *next; +} abook_list; + +enum rotate_dir { + ROTATE_LEFT, + ROTATE_RIGHT +}; + char *revstr(char *str); char *strupper(char *str); char *strlower(char *str); @@ -20,6 +30,16 @@ int strwidth(const char *s); int bytes2width(const char *s, int width); +void abook_list_append(abook_list **list, char *str); +void abook_list_free(abook_list **list); +char *abook_list_to_csv(abook_list *list); +abook_list *csv_to_abook_list(char *str); +void abook_list_rotate(abook_list **list, enum rotate_dir dir); +void abook_list_replace(abook_list **list, int index, char *str); +abook_list *abook_list_get(abook_list *list, int index); +#define abook_list_delete(list, index) abook_list_replace(list, index, NULL) + + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -34,3 +54,6 @@ int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); #endif #endif + + +