projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add more encoding arrays
[apps/madmutt.git]
/
mx.c
diff --git
a/mx.c
b/mx.c
index
9400483
..
5348821
100644
(file)
--- a/
mx.c
+++ b/
mx.c
@@
-13,10
+13,13
@@
#endif
#include <lib-lib/mem.h>
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/ascii.h>
+#include <lib-lib/str.h>
+#include <lib-lib/macros.h>
+#include <lib-lib/file.h>
#include "mutt.h"
#include "buffy.h"
#include "mutt.h"
#include "buffy.h"
-#include "ascii.h"
#include "mx.h"
#include "mbox.h"
#include "mh.h"
#include "mx.h"
#include "mbox.h"
#include "mh.h"
@@
-53,8
+56,6
@@
#include "mutt_crypt.h"
#include "mutt_crypt.h"
-#include "lib/intl.h"
-#include "lib/str.h"
#include "lib/list.h"
#include "lib/debug.h"
#include "lib/list.h"
#include "lib/debug.h"
@@
-73,7
+74,7
@@
static list2_t* MailboxFormats = NULL;
#define MX_COMMAND(idx,cmd) ((mx_t*) MailboxFormats->data[idx])->cmd
#define MX_IDX(idx) (idx >= 0 && idx < MailboxFormats->length)
#define MX_COMMAND(idx,cmd) ((mx_t*) MailboxFormats->data[idx])->cmd
#define MX_IDX(idx) (idx >= 0 && idx < MailboxFormats->length)
-#define mutt_is_spool(s) (
str_cmp
(Spoolfile, s) == 0)
+#define mutt_is_spool(s) (
m_strcmp
(Spoolfile, s) == 0)
#ifdef USE_DOTLOCK
/* parameters:
#ifdef USE_DOTLOCK
/* parameters:
@@
-193,7
+194,7
@@
int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
struct flock lck;
struct flock lck;
-
memset (&lck, 0, sizeof (struct flock)
);
+
p_clear(&lck, 1
);
lck.l_type = excl ? F_WRLCK : F_RDLCK;
lck.l_whence = SEEK_SET;
lck.l_type = excl ? F_WRLCK : F_RDLCK;
lck.l_whence = SEEK_SET;
@@
-294,7
+295,7
@@
int mx_unlock_file (const char *path, int fd, int dot)
#ifdef USE_FCNTL
struct flock unlockit;
#ifdef USE_FCNTL
struct flock unlockit;
-
memset (&unlockit, 0, sizeof (struct flock)
);
+
p_clear(&unlockit, 1
);
unlockit.l_type = F_UNLCK;
unlockit.l_whence = SEEK_SET;
fcntl (fd, F_SETLK, &unlockit);
unlockit.l_type = F_UNLCK;
unlockit.l_whence = SEEK_SET;
fcntl (fd, F_SETLK, &unlockit);
@@
-343,7
+344,7
@@
void mx_unlink_empty (const char *path)
int mx_get_magic (const char *path) {
int i = 0;
int mx_get_magic (const char *path) {
int i = 0;
- if (
str_len
(path) == 0)
+ if (
m_strlen
(path) == 0)
return (-1);
if ((i = mx_get_idx (path)) >= 0)
return (MX_COMMAND(i,type));
return (-1);
if ((i = mx_get_idx (path)) >= 0)
return (MX_COMMAND(i,type));
@@
-521,7
+522,7
@@
CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT * pctx)
if (!ctx)
ctx = p_new(CONTEXT, 1);
p_clear(ctx, 1);
if (!ctx)
ctx = p_new(CONTEXT, 1);
p_clear(ctx, 1);
- ctx->path =
str_dup
(path);
+ ctx->path =
m_strdup
(path);
ctx->msgnotreadyet = -1;
ctx->collapsed = 0;
ctx->msgnotreadyet = -1;
ctx->collapsed = 0;
@@
-625,7
+626,7
@@
void mx_fastclose_mailbox (CONTEXT * ctx)
if (ctx->limit_pattern)
mutt_pattern_free (&ctx->limit_pattern);
safe_fclose (&ctx->fp);
if (ctx->limit_pattern)
mutt_pattern_free (&ctx->limit_pattern);
safe_fclose (&ctx->fp);
-
memset (ctx, 0, sizeof (CONTEXT)
);
+
p_clear(ctx, 1
);
}
/* save changes to disk */
}
/* save changes to disk */
@@
-744,10
+745,10
@@
static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
if ((p = mutt_find_hook (M_MBOXHOOK, ctx->path))) {
isSpool = 1;
if ((p = mutt_find_hook (M_MBOXHOOK, ctx->path))) {
isSpool = 1;
-
strfcpy (mbox, p, sizeof (mbox)
);
+
m_strcpy(mbox, sizeof(mbox), p
);
}
else {
}
else {
-
strfcpy (mbox, NONULL (Inbox), sizeof (m
box));
+
m_strcpy(mbox, sizeof(mbox), NONULL(In
box));
isSpool = mutt_is_spool (ctx->path) && !mutt_is_spool (mbox);
}
mutt_expand_path (mbox, sizeof (mbox));
isSpool = mutt_is_spool (ctx->path) && !mutt_is_spool (mbox);
}
mutt_expand_path (mbox, sizeof (mbox));
@@
-1008,8
+1009,7
@@
static int _mx_sync_mailbox (CONTEXT * ctx, int *index_hint)
km_find_func (MENU_MAIN, OP_TOGGLE_WRITE)))
snprintf (tmp, sizeof (tmp), _(" Press '%s' to toggle write"), buf);
else
km_find_func (MENU_MAIN, OP_TOGGLE_WRITE)))
snprintf (tmp, sizeof (tmp), _(" Press '%s' to toggle write"), buf);
else
- strfcpy (tmp, _("Use 'toggle-write' to re-enable write!"),
- sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), _("Use 'toggle-write' to re-enable write!"));
mutt_error (_("Mailbox is marked unwritable. %s"), tmp);
return -1;
mutt_error (_("Mailbox is marked unwritable. %s"), tmp);
return -1;