-
Notifications
You must be signed in to change notification settings - Fork 9
/
misc.h
61 lines (45 loc) · 1.38 KB
/
misc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#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);
char *strtrim(char *);
int is_number(char *s);
char *strdup_printf(const char *format, ... );
char *strconcat(const char *str, ...);
int safe_strcmp(const char *s1, const char *s2);
int safe_strcoll(const char *s1, const char *s2);
char *my_getcwd();
char *getaline(FILE *f);
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
#include <stdarg.h>
#ifndef HAVE_SNPRINTF
int snprintf (char *str, size_t count, const char *fmt, ...);
#endif
#ifndef HAVE_VSNPRINTF
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
#endif
#ifndef HAVE_STRCASESTR
char *strcasestr(const char *, const char *);
#endif
#endif