]> git.deb.at Git - pkg/abook.git/blob - misc.h
Upload 0.6.1-2 to unstable
[pkg/abook.git] / misc.h
1 #ifndef _MISC_H
2 #define _MISC_H
3
4 typedef struct abook_list_t {
5         char *data;
6         struct abook_list_t *next;
7 } abook_list;
8
9 enum rotate_dir {
10         ROTATE_LEFT,
11         ROTATE_RIGHT
12 };
13
14 char            *revstr(char *str);
15 char            *strupper(char *str);
16 char            *strlower(char *str);
17 char            *strtrim(char *);
18
19 int             is_number(char *s);
20
21 char            *strdup_printf(const char *format, ... );
22 char            *strconcat(const char *str, ...);
23
24 int             safe_strcmp(const char *s1, const char *s2);
25 int             safe_strcoll(const char *s1, const char *s2);
26
27 char            *my_getcwd();
28
29 char            *getaline(FILE *f);
30
31 int             strwidth(const char *s);
32 int             bytes2width(const char *s, int width);
33
34
35 void            abook_list_append(abook_list **list, char *str);
36 void            abook_list_free(abook_list **list);
37 char            *abook_list_to_csv(abook_list *list);
38 abook_list      *csv_to_abook_list(char *str);
39 void            abook_list_rotate(abook_list **list, enum rotate_dir dir);
40 void            abook_list_replace(abook_list **list, int index, char *str);
41 abook_list      *abook_list_get(abook_list *list, int index);
42 #define abook_list_delete(list, index) abook_list_replace(list, index, NULL)
43
44
45 #ifdef HAVE_CONFIG_H
46 #       include "config.h"
47 #endif
48
49 #include <stdarg.h>
50
51 #ifndef HAVE_SNPRINTF
52 int snprintf (char *str, size_t count, const char *fmt, ...);
53 #endif
54 #ifndef HAVE_VSNPRINTF
55 int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
56 #endif
57 #ifndef HAVE_STRCASESTR
58 char *strcasestr(const char *, const char *);
59 #endif
60
61 #endif