use automake 1.11, autoconf 2.65
[abook.git] / misc.h
blobc5f7ac1ba3acdacfb220afb6489ead8c8b462f1c
1 #ifndef _MISC_H
2 #define _MISC_H
4 typedef struct abook_list_t {
5 char *data;
6 struct abook_list_t *next;
7 } abook_list;
9 enum rotate_dir {
10 ROTATE_LEFT,
11 ROTATE_RIGHT
14 char *revstr(char *str);
15 char *strupper(char *str);
16 char *strlower(char *str);
17 char *strtrim(char *);
19 int is_number(char *s);
21 char *strcasestr(char *haystack, char *needle);
23 char *strdup_printf(const char *format, ... );
24 char *strconcat(const char *str, ...);
26 int safe_strcmp(const char *s1, const char *s2);
27 int safe_strcoll(const char *s1, const char *s2);
29 char *my_getcwd();
31 char *getaline(FILE *f);
33 int strwidth(const char *s);
34 int bytes2width(const char *s, int width);
37 void abook_list_append(abook_list **list, char *str);
38 void abook_list_free(abook_list **list);
39 char *abook_list_to_csv(abook_list *list);
40 abook_list *csv_to_abook_list(char *str);
41 void abook_list_rotate(abook_list **list, enum rotate_dir dir);
42 void abook_list_replace(abook_list **list, int index, char *str);
43 abook_list *abook_list_get(abook_list *list, int index);
44 #define abook_list_delete(list, index) abook_list_replace(list, index, NULL)
47 #ifdef HAVE_CONFIG_H
48 # include "config.h"
49 #endif
51 #include <stdarg.h>
53 #ifndef HAVE_SNPRINTF
54 int snprintf (char *str, size_t count, const char *fmt, ...);
55 #endif
56 #ifndef HAVE_VSNPRINTF
57 int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
58 #endif
60 #endif