Remove the bits for pthread in misc.h
Showing
4 changed files
with
66 additions
and
118 deletions
... | @@ -101,7 +101,7 @@ main(int argc, char **argv) | ... | @@ -101,7 +101,7 @@ main(int argc, char **argv) |
101 | address_t address = NULL; | 101 | address_t address = NULL; |
102 | address_create (&address, buf); | 102 | address_create (&address, buf); |
103 | len = 0; | 103 | len = 0; |
104 | address_get_personal (address, personal, sizeof (personal), &len); | 104 | address_get_personal (address, 1, personal, sizeof (personal), &len); |
105 | printf ("%s\t", (len != 0) ? personal : buf); | 105 | printf ("%s\t", (len != 0) ? personal : buf); |
106 | address_destroy (&address); | 106 | address_destroy (&address); |
107 | } | 107 | } | ... | ... |
... | @@ -44,13 +44,11 @@ extern "C" { | ... | @@ -44,13 +44,11 @@ extern "C" { |
44 | struct _folder; | 44 | struct _folder; |
45 | typedef struct _folder *folder_t; | 45 | typedef struct _folder *folder_t; |
46 | 46 | ||
47 | #define MU_FOLDER_ATTRIBUTE_NOINFERIORS 0x001 | 47 | #define MU_FOLDER_ATTRIBUTE_DIRECTORY 0x001 |
48 | #define MU_FOLDER_ATTRIBUTE_NOSELECT 0x002 | 48 | #define MU_FOLDER_ATTRIBUTE_FILE 0x002 |
49 | #define MU_FOLDER_ATTRIBUTE_MARKED 0x004 | ||
50 | #define MU_FOLDER_ATTRIBUTE_UNMARKED 0x008 | ||
51 | struct folder_list | 49 | struct folder_list |
52 | { | 50 | { |
53 | int attribute; | 51 | int type; |
54 | int separator; | 52 | int separator; |
55 | char *name; | 53 | char *name; |
56 | }; | 54 | }; |
... | @@ -62,10 +60,14 @@ extern void folder_destroy __P ((folder_t *)); | ... | @@ -62,10 +60,14 @@ extern void folder_destroy __P ((folder_t *)); |
62 | extern int folder_open __P ((folder_t, int flag)); | 60 | extern int folder_open __P ((folder_t, int flag)); |
63 | extern int folder_close __P ((folder_t)); | 61 | extern int folder_close __P ((folder_t)); |
64 | 62 | ||
65 | extern int folder_delete_mailbox __P ((folder_t, const char *)); | 63 | extern int folder_delete __P ((folder_t, const char *)); |
66 | 64 | extern int folder_rename __P ((folder_t, const char *, const char *)); | |
65 | extern int folder_subscribe __P ((folder_t, const char *)); | ||
66 | extern int folder_unsubscribe __P ((folder_t, const char *)); | ||
67 | extern int folder_list __P ((folder_t, const char *pattern, | 67 | extern int folder_list __P ((folder_t, const char *pattern, |
68 | struct folder_list ***flist, size_t *)); | 68 | struct folder_list ***flist, size_t *)); |
69 | extern int folder_lsub __P ((folder_t, const char *pattern, | ||
70 | struct folder_list ***flist, size_t *)); | ||
69 | extern int folder_list_destroy __P ((struct folder_list ***, size_t)); | 71 | extern int folder_list_destroy __P ((struct folder_list ***, size_t)); |
70 | 72 | ||
71 | /* Stream settings. */ | 73 | /* Stream settings. */ |
... | @@ -74,7 +76,6 @@ extern int folder_set_stream __P ((folder_t, stream_t)); | ... | @@ -74,7 +76,6 @@ extern int folder_set_stream __P ((folder_t, stream_t)); |
74 | 76 | ||
75 | /* Notifications. */ | 77 | /* Notifications. */ |
76 | extern int folder_get_observable __P ((folder_t, observable_t *)); | 78 | extern int folder_get_observable __P ((folder_t, observable_t *)); |
77 | extern int folder_set_observable __P ((folder_t, observable_t)); | ||
78 | extern int folder_get_debug __P ((folder_t, debug_t *)); | 79 | extern int folder_get_debug __P ((folder_t, debug_t *)); |
79 | extern int folder_set_debug __P ((folder_t, debug_t)); | 80 | extern int folder_set_debug __P ((folder_t, debug_t)); |
80 | 81 | ... | ... |
... | @@ -38,103 +38,85 @@ | ... | @@ -38,103 +38,85 @@ |
38 | extern "C" { | 38 | extern "C" { |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | struct mailbox_entry; | 41 | /* Record. */ |
42 | typedef struct mailbox_entry* mailbox_entry_t; | ||
43 | struct mailer_entry; | ||
44 | typedef struct mailer_entry* mailer_entry_t; | ||
45 | struct folder_entry; | ||
46 | typedef struct folder_entry* folder_entry_t; | ||
47 | struct _registrar_record; | ||
48 | typedef struct _registrar_record* registrar_record_t; | ||
49 | |||
50 | struct mailbox_entry | ||
51 | { | ||
52 | int (*_url_init) __P ((url_t)); | ||
53 | int (*_mailbox_init) __P ((mailbox_t)); | ||
54 | }; | ||
55 | struct mailer_entry | ||
56 | { | ||
57 | int (*_url_init) __P ((url_t)); | ||
58 | int (*_mailer_init) __P ((mailer_t)); | ||
59 | }; | ||
60 | struct folder_entry | ||
61 | { | ||
62 | int (*_url_init) __P ((url_t)); | ||
63 | int (*_folder_init) __P ((folder_t)); | ||
64 | }; | ||
65 | |||
66 | struct _record; | 42 | struct _record; |
67 | typedef struct _record* record_t; | 43 | typedef struct _record* record_t; |
68 | 44 | ||
45 | /* Public Interface, to allow static initialization. */ | ||
46 | struct _record | ||
47 | { | ||
48 | /* Should not be access directly but rather by the stub functions. */ | ||
49 | const char *scheme; | ||
50 | int (*_url) __P ((url_t)); | ||
51 | int (*_mailbox) __P ((mailbox_t)); | ||
52 | int (*_mailer) __P ((mailer_t)); | ||
53 | int (*_folder) __P ((folder_t)); | ||
54 | void *data; /* back pointer. */ | ||
55 | |||
56 | /* Stub functions to override. The defaut is to return the fields. */ | ||
57 | int (*_is_scheme) __P ((record_t, const char *)); | ||
58 | int (*_get_url) __P ((record_t, int (*(*_url)) __P ((url_t)))); | ||
59 | int (*_get_mailbox) __P ((record_t, int (*(*_mailbox)) __P ((mailbox_t)))); | ||
60 | int (*_get_mailer) __P ((record_t, int (*(*_mailer)) __P ((mailer_t)))); | ||
61 | int (*_get_folder) __P ((record_t, int (*(*_folder)) __P ((folder_t)))); | ||
62 | }; | ||
63 | |||
69 | /* Registration. */ | 64 | /* Registration. */ |
70 | extern int registrar_get_list __P ((list_t *)); | 65 | extern int registrar_get_list __P ((list_t *)); |
71 | extern int registrar_record __P ((record_t)); | 66 | extern int registrar_record __P ((record_t)); |
72 | extern int unregistrar_record __P ((record_t)); | 67 | extern int unregistrar_record __P ((record_t)); |
73 | 68 | ||
74 | /* Record. */ | 69 | /* Scheme. */ |
75 | extern int record_create __P ((record_t *, void *owner)); | ||
76 | extern void record_destroy __P ((record_t *)); | ||
77 | |||
78 | extern int record_is_scheme __P ((record_t, const char *)); | 70 | extern int record_is_scheme __P ((record_t, const char *)); |
79 | extern int record_set_scheme __P ((record_t, const char *)); | 71 | extern int record_set_scheme __P ((record_t, const char *)); |
80 | extern int record_set_is_scheme __P ((record_t, int (*_is_scheme) | 72 | extern int record_set_is_scheme __P ((record_t, int (*_is_scheme) |
81 | __P ((const char *)))); | 73 | __P ((record_t, const char *)))); |
82 | extern int record_get_mailbox __P ((record_t, mailbox_entry_t *)); | 74 | |
83 | extern int record_set_mailbox __P ((record_t, mailbox_entry_t)); | 75 | /* Url. */ |
76 | extern int record_get_url __P ((record_t, int (*(*)) __P ((url_t)))); | ||
77 | extern int record_set_url __P ((record_t, int (*) __P ((url_t)))); | ||
78 | extern int record_set_get_url __P ((record_t, int (*_get_url) | ||
79 | __P ((record_t, | ||
80 | int (*(*)) __P ((url_t)))))); | ||
81 | /* Mailbox. */ | ||
82 | extern int record_get_mailbox __P ((record_t, int (*(*)) | ||
83 | __P ((mailbox_t)))); | ||
84 | extern int record_set_mailbox __P ((record_t, int (*) __P ((mailbox_t)))); | ||
84 | extern int record_set_get_mailbox __P ((record_t, int (*_get_mailbox) | 85 | extern int record_set_get_mailbox __P ((record_t, int (*_get_mailbox) |
85 | __P ((mailbox_entry_t *)))); | 86 | __P ((record_t, |
86 | extern int record_get_mailer __P ((record_t, mailer_entry_t *)); | 87 | int (*(*)) __P((mailbox_t)))))); |
87 | extern int record_set_mailer __P ((record_t, mailer_entry_t)); | 88 | /* Mailer. */ |
89 | extern int record_get_mailer __P ((record_t, | ||
90 | int (*(*)) __P ((mailer_t)))); | ||
91 | extern int record_set_mailer __P ((record_t, int (*) __P ((mailer_t)))); | ||
88 | extern int record_set_get_mailer __P ((record_t, int (*_get_mailer) | 92 | extern int record_set_get_mailer __P ((record_t, int (*_get_mailer) |
89 | __P ((mailer_entry_t *)))); | 93 | __P ((record_t, |
90 | extern int record_get_folder __P ((record_t, folder_entry_t *)); | 94 | int (*(*)) __P ((mailer_t)))))); |
91 | extern int record_set_folder __P ((record_t, folder_entry_t)); | 95 | /* Folder. */ |
96 | extern int record_get_folder __P ((record_t, | ||
97 | int (*(*)) __P ((folder_t)))); | ||
98 | extern int record_set_folder __P ((record_t, int (*) __P ((folder_t)))); | ||
92 | extern int record_set_get_folder __P ((record_t, int (*_get_folder) | 99 | extern int record_set_get_folder __P ((record_t, int (*_get_folder) |
93 | __P ((folder_entry_t *)))); | 100 | __P ((record_t, |
101 | int (*(*)) __P ((folder_t)))))); | ||
94 | 102 | ||
95 | #define MU_POP_PORT 110 | 103 | /* Records provided by the library. */ |
96 | #define MU_POP_SCHEME "pop://" | ||
97 | #define MU_POP_SCHEME_LEN 6 | ||
98 | extern int url_pop_init __P ((url_t)); | ||
99 | extern mailbox_entry_t pop_entry; | ||
100 | extern record_t pop_record; | ||
101 | 104 | ||
102 | #define MU_IMAP_PORT 143 | 105 | /* Remote Folder "imap://" */ |
103 | #define MU_IMAP_SCHEME "imap://" | ||
104 | #define MU_IMAP_SCHEME_LEN 7 | ||
105 | extern int url_imap_init __P ((url_t)); | ||
106 | extern folder_entry_t imap_entry; | ||
107 | extern record_t imap_record; | 106 | extern record_t imap_record; |
107 | /* Remote Mailbox POP3, pop:// */ | ||
108 | extern record_t pop_record; | ||
108 | 109 | ||
109 | #define MU_MBOX_SCHEME "mbox:" | 110 | /* Local Mailbox Unix Mailbox, "mbox:" */ |
110 | #define MU_MBOX_SCHEME_LEN 5 | ||
111 | extern int url_mbox_init __P ((url_t)); | ||
112 | extern mailbox_entry_t mbox_entry; | ||
113 | extern record_t mbox_record; | 111 | extern record_t mbox_record; |
114 | 112 | /* Local Folder/Mailbox, "file:" */ | |
115 | #define MU_FILE_SCHEME "file:" | ||
116 | #define MU_FILE_SCHEME_LEN 5 | ||
117 | extern int url_file_init __P ((url_t)); | ||
118 | extern mailbox_entry_t file_entry; | ||
119 | extern record_t file_record; | 113 | extern record_t file_record; |
120 | 114 | /* Local Folder/Mailbox, / */ | |
121 | #define MU_PATH_SCHEME "/" | ||
122 | #define MU_PATH_SCHEME_LEN 1 | ||
123 | extern int url_path_init __P ((url_t)); | ||
124 | extern mailbox_entry_t path_entry; | ||
125 | extern record_t path_record; | 115 | extern record_t path_record; |
126 | 116 | ||
127 | #define MU_SMTP_SCHEME "smtp://" | 117 | /* SMTP mailer, "smtp://" */ |
128 | #define MU_SMTP_SCHEME_LEN 7 | ||
129 | #define MU_SMTP_PORT 25 | ||
130 | extern int url_smtp_init __P ((url_t)); | ||
131 | extern mailer_entry_t smtp_entry; | ||
132 | extern record_t smtp_record; | 118 | extern record_t smtp_record; |
133 | 119 | /* Sendmail, "sendmail:" */ | |
134 | #define MU_SENDMAIL_SCHEME "sendmail:" | ||
135 | #define MU_SENDMAIL_SCHEME_LEN 9 | ||
136 | extern int url_sendmail_init __P ((url_t)); | ||
137 | extern mailer_entry_t sendmail_entry; | ||
138 | extern record_t sendmail_record; | 120 | extern record_t sendmail_record; |
139 | 121 | ||
140 | #ifdef _cplusplus | 122 | #ifdef _cplusplus | ... | ... |
... | @@ -42,41 +42,6 @@ extern "C" { | ... | @@ -42,41 +42,6 @@ extern "C" { |
42 | extern size_t _cpystr __P ((char *dst, const char *src, size_t size)); | 42 | extern size_t _cpystr __P ((char *dst, const char *src, size_t size)); |
43 | extern int parseaddr __P ((const char *addr, char *buf, size_t bufsz)); | 43 | extern int parseaddr __P ((const char *addr, char *buf, size_t bufsz)); |
44 | 44 | ||
45 | #ifdef HAVE_PTHREAD_H | ||
46 | # define __USE_UNIX98 | ||
47 | # include <pthread.h> | ||
48 | #endif | ||
49 | |||
50 | #ifdef WITH_PTHREAD | ||
51 | # if 0 | ||
52 | # define RWLOCK_INIT(rwl, attr) pthread_mutex_init (rwl, attr) | ||
53 | # define RWLOCK_DESTROY(rwl) pthread_mutex_destroy (rwl) | ||
54 | # define RWLOCK_RDLOCK(rwl) pthread_mutex_lock (rwl) | ||
55 | # define RWLOCK_TRYRDLOCK(rwl) pthread_mutex_trylock (rwl) | ||
56 | # define RWLOCK_WRLOCK(rwl) pthread_mutex_lock (rwl) | ||
57 | # define RWLOCK_TRYWRLOCK(rwl) pthread_mutex_trylock (rwl) | ||
58 | # define RWLOCK_UNLOCK(rwl) pthread_mutex_unlock (rwl) | ||
59 | # else | ||
60 | # define RWLOCK_INIT(rwl, attr) pthread_rwlock_init (rwl, attr) | ||
61 | # define RWLOCK_DESTROY(rwl) pthread_rwlock_destroy (rwl) | ||
62 | # define RWLOCK_RDLOCK(rwl) pthread_rwlock_rdlock (rwl) | ||
63 | # define RWLOCK_TRYRDLOCK(rwl) pthread_rwlock_tryrdlock (rwl) | ||
64 | # define RWLOCK_WRLOCK(rwl) pthread_rwlock_wrlock (rwl) | ||
65 | # define RWLOCK_TRYWRLOCK(rwl) pthread_rwlock_trywrlock (rwl) | ||
66 | # define RWLOCK_UNLOCK(rwl) pthread_rwlock_unlock (rwl) | ||
67 | # endif | ||
68 | #else | ||
69 | # define RWLOCK_INIT(rwl, attr) 0 | ||
70 | # define RWLOCK_DESTROY(rwl) | ||
71 | # define RWLOCK_RDLOCK(rwl) | ||
72 | # define RWLOCK_TRYRDLOCK(rwl) | ||
73 | # define RWLOCK_WRLOCK(rwl) | ||
74 | # define RWLOCK_TRYWRLOCK(rwl) | ||
75 | # define RWLOCK_UNLOCK(rwl) | ||
76 | # define flockfile(arg) | ||
77 | # define funlockfile(arg) | ||
78 | #endif | ||
79 | |||
80 | #ifdef __cplusplus | 45 | #ifdef __cplusplus |
81 | } | 46 | } |
82 | #endif | 47 | #endif | ... | ... |
-
Please register or sign in to post a comment