Commit 4e0e1389 4e0e1389e8e161ce722c86e6d5b439a0e56cd9ea by Alain Magloire

Remove the bits for pthread in misc.h

1 parent ac0faac9
......@@ -101,7 +101,7 @@ main(int argc, char **argv)
address_t address = NULL;
address_create (&address, buf);
len = 0;
address_get_personal (address, personal, sizeof (personal), &len);
address_get_personal (address, 1, personal, sizeof (personal), &len);
printf ("%s\t", (len != 0) ? personal : buf);
address_destroy (&address);
}
......
......@@ -44,13 +44,11 @@ extern "C" {
struct _folder;
typedef struct _folder *folder_t;
#define MU_FOLDER_ATTRIBUTE_NOINFERIORS 0x001
#define MU_FOLDER_ATTRIBUTE_NOSELECT 0x002
#define MU_FOLDER_ATTRIBUTE_MARKED 0x004
#define MU_FOLDER_ATTRIBUTE_UNMARKED 0x008
#define MU_FOLDER_ATTRIBUTE_DIRECTORY 0x001
#define MU_FOLDER_ATTRIBUTE_FILE 0x002
struct folder_list
{
int attribute;
int type;
int separator;
char *name;
};
......@@ -62,10 +60,14 @@ extern void folder_destroy __P ((folder_t *));
extern int folder_open __P ((folder_t, int flag));
extern int folder_close __P ((folder_t));
extern int folder_delete_mailbox __P ((folder_t, const char *));
extern int folder_delete __P ((folder_t, const char *));
extern int folder_rename __P ((folder_t, const char *, const char *));
extern int folder_subscribe __P ((folder_t, const char *));
extern int folder_unsubscribe __P ((folder_t, const char *));
extern int folder_list __P ((folder_t, const char *pattern,
struct folder_list ***flist, size_t *));
extern int folder_lsub __P ((folder_t, const char *pattern,
struct folder_list ***flist, size_t *));
extern int folder_list_destroy __P ((struct folder_list ***, size_t));
/* Stream settings. */
......@@ -74,7 +76,6 @@ extern int folder_set_stream __P ((folder_t, stream_t));
/* Notifications. */
extern int folder_get_observable __P ((folder_t, observable_t *));
extern int folder_set_observable __P ((folder_t, observable_t));
extern int folder_get_debug __P ((folder_t, debug_t *));
extern int folder_set_debug __P ((folder_t, debug_t));
......
......@@ -38,103 +38,85 @@
extern "C" {
#endif
struct mailbox_entry;
typedef struct mailbox_entry* mailbox_entry_t;
struct mailer_entry;
typedef struct mailer_entry* mailer_entry_t;
struct folder_entry;
typedef struct folder_entry* folder_entry_t;
struct _registrar_record;
typedef struct _registrar_record* registrar_record_t;
struct mailbox_entry
{
int (*_url_init) __P ((url_t));
int (*_mailbox_init) __P ((mailbox_t));
};
struct mailer_entry
{
int (*_url_init) __P ((url_t));
int (*_mailer_init) __P ((mailer_t));
};
struct folder_entry
{
int (*_url_init) __P ((url_t));
int (*_folder_init) __P ((folder_t));
};
/* Record. */
struct _record;
typedef struct _record* record_t;
/* Public Interface, to allow static initialization. */
struct _record
{
/* Should not be access directly but rather by the stub functions. */
const char *scheme;
int (*_url) __P ((url_t));
int (*_mailbox) __P ((mailbox_t));
int (*_mailer) __P ((mailer_t));
int (*_folder) __P ((folder_t));
void *data; /* back pointer. */
/* Stub functions to override. The defaut is to return the fields. */
int (*_is_scheme) __P ((record_t, const char *));
int (*_get_url) __P ((record_t, int (*(*_url)) __P ((url_t))));
int (*_get_mailbox) __P ((record_t, int (*(*_mailbox)) __P ((mailbox_t))));
int (*_get_mailer) __P ((record_t, int (*(*_mailer)) __P ((mailer_t))));
int (*_get_folder) __P ((record_t, int (*(*_folder)) __P ((folder_t))));
};
/* Registration. */
extern int registrar_get_list __P ((list_t *));
extern int registrar_record __P ((record_t));
extern int unregistrar_record __P ((record_t));
/* Record. */
extern int record_create __P ((record_t *, void *owner));
extern void record_destroy __P ((record_t *));
/* Scheme. */
extern int record_is_scheme __P ((record_t, const char *));
extern int record_set_scheme __P ((record_t, const char *));
extern int record_set_is_scheme __P ((record_t, int (*_is_scheme)
__P ((const char *))));
extern int record_get_mailbox __P ((record_t, mailbox_entry_t *));
extern int record_set_mailbox __P ((record_t, mailbox_entry_t));
__P ((record_t, const char *))));
/* Url. */
extern int record_get_url __P ((record_t, int (*(*)) __P ((url_t))));
extern int record_set_url __P ((record_t, int (*) __P ((url_t))));
extern int record_set_get_url __P ((record_t, int (*_get_url)
__P ((record_t,
int (*(*)) __P ((url_t))))));
/* Mailbox. */
extern int record_get_mailbox __P ((record_t, int (*(*))
__P ((mailbox_t))));
extern int record_set_mailbox __P ((record_t, int (*) __P ((mailbox_t))));
extern int record_set_get_mailbox __P ((record_t, int (*_get_mailbox)
__P ((mailbox_entry_t *))));
extern int record_get_mailer __P ((record_t, mailer_entry_t *));
extern int record_set_mailer __P ((record_t, mailer_entry_t));
__P ((record_t,
int (*(*)) __P((mailbox_t))))));
/* Mailer. */
extern int record_get_mailer __P ((record_t,
int (*(*)) __P ((mailer_t))));
extern int record_set_mailer __P ((record_t, int (*) __P ((mailer_t))));
extern int record_set_get_mailer __P ((record_t, int (*_get_mailer)
__P ((mailer_entry_t *))));
extern int record_get_folder __P ((record_t, folder_entry_t *));
extern int record_set_folder __P ((record_t, folder_entry_t));
__P ((record_t,
int (*(*)) __P ((mailer_t))))));
/* Folder. */
extern int record_get_folder __P ((record_t,
int (*(*)) __P ((folder_t))));
extern int record_set_folder __P ((record_t, int (*) __P ((folder_t))));
extern int record_set_get_folder __P ((record_t, int (*_get_folder)
__P ((folder_entry_t *))));
__P ((record_t,
int (*(*)) __P ((folder_t))))));
#define MU_POP_PORT 110
#define MU_POP_SCHEME "pop://"
#define MU_POP_SCHEME_LEN 6
extern int url_pop_init __P ((url_t));
extern mailbox_entry_t pop_entry;
extern record_t pop_record;
/* Records provided by the library. */
#define MU_IMAP_PORT 143
#define MU_IMAP_SCHEME "imap://"
#define MU_IMAP_SCHEME_LEN 7
extern int url_imap_init __P ((url_t));
extern folder_entry_t imap_entry;
/* Remote Folder "imap://" */
extern record_t imap_record;
/* Remote Mailbox POP3, pop:// */
extern record_t pop_record;
#define MU_MBOX_SCHEME "mbox:"
#define MU_MBOX_SCHEME_LEN 5
extern int url_mbox_init __P ((url_t));
extern mailbox_entry_t mbox_entry;
/* Local Mailbox Unix Mailbox, "mbox:" */
extern record_t mbox_record;
#define MU_FILE_SCHEME "file:"
#define MU_FILE_SCHEME_LEN 5
extern int url_file_init __P ((url_t));
extern mailbox_entry_t file_entry;
/* Local Folder/Mailbox, "file:" */
extern record_t file_record;
#define MU_PATH_SCHEME "/"
#define MU_PATH_SCHEME_LEN 1
extern int url_path_init __P ((url_t));
extern mailbox_entry_t path_entry;
/* Local Folder/Mailbox, / */
extern record_t path_record;
#define MU_SMTP_SCHEME "smtp://"
#define MU_SMTP_SCHEME_LEN 7
#define MU_SMTP_PORT 25
extern int url_smtp_init __P ((url_t));
extern mailer_entry_t smtp_entry;
/* SMTP mailer, "smtp://" */
extern record_t smtp_record;
#define MU_SENDMAIL_SCHEME "sendmail:"
#define MU_SENDMAIL_SCHEME_LEN 9
extern int url_sendmail_init __P ((url_t));
extern mailer_entry_t sendmail_entry;
/* Sendmail, "sendmail:" */
extern record_t sendmail_record;
#ifdef _cplusplus
......
......@@ -42,41 +42,6 @@ extern "C" {
extern size_t _cpystr __P ((char *dst, const char *src, size_t size));
extern int parseaddr __P ((const char *addr, char *buf, size_t bufsz));
#ifdef HAVE_PTHREAD_H
# define __USE_UNIX98
# include <pthread.h>
#endif
#ifdef WITH_PTHREAD
# if 0
# define RWLOCK_INIT(rwl, attr) pthread_mutex_init (rwl, attr)
# define RWLOCK_DESTROY(rwl) pthread_mutex_destroy (rwl)
# define RWLOCK_RDLOCK(rwl) pthread_mutex_lock (rwl)
# define RWLOCK_TRYRDLOCK(rwl) pthread_mutex_trylock (rwl)
# define RWLOCK_WRLOCK(rwl) pthread_mutex_lock (rwl)
# define RWLOCK_TRYWRLOCK(rwl) pthread_mutex_trylock (rwl)
# define RWLOCK_UNLOCK(rwl) pthread_mutex_unlock (rwl)
# else
# define RWLOCK_INIT(rwl, attr) pthread_rwlock_init (rwl, attr)
# define RWLOCK_DESTROY(rwl) pthread_rwlock_destroy (rwl)
# define RWLOCK_RDLOCK(rwl) pthread_rwlock_rdlock (rwl)
# define RWLOCK_TRYRDLOCK(rwl) pthread_rwlock_tryrdlock (rwl)
# define RWLOCK_WRLOCK(rwl) pthread_rwlock_wrlock (rwl)
# define RWLOCK_TRYWRLOCK(rwl) pthread_rwlock_trywrlock (rwl)
# define RWLOCK_UNLOCK(rwl) pthread_rwlock_unlock (rwl)
# endif
#else
# define RWLOCK_INIT(rwl, attr) 0
# define RWLOCK_DESTROY(rwl)
# define RWLOCK_RDLOCK(rwl)
# define RWLOCK_TRYRDLOCK(rwl)
# define RWLOCK_WRLOCK(rwl)
# define RWLOCK_TRYWRLOCK(rwl)
# define RWLOCK_UNLOCK(rwl)
# define flockfile(arg)
# define funlockfile(arg)
#endif
#ifdef __cplusplus
}
#endif
......