remove old cruft too.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
#include "mutt.h"
/* raw bytes to null-terminated base 64 string */
-void mutt_to_base64 (unsigned char *out, const unsigned char *in, size_t len,
- size_t olen)
+void mutt_to_base64 (unsigned char *out, const unsigned char *in, ssize_t len,
+ ssize_t olen)
{
while (len >= 3 && olen > 10) {
*out++ = __m_b64chars[in[0] >> 2];
/* Frees up the memory allocated for the local-global variables. */
static void destroy_state (struct browser_state *state)
{
- unsigned int c;
+ int c;
for (c = 0; c < state->entrylen; c++) {
p_delete(&((state->entry)[c].name));
return 0;
}
-static const char *folder_format_str (char *dest, size_t destlen, char op,
+static const char *folder_format_str (char *dest, ssize_t destlen, char op,
const char *src, const char *fmt,
const char *ifstring,
const char *elsestring,
}
#ifdef USE_NNTP
-static const char *newsgroup_format_str (char *dest, size_t destlen, char op,
+static const char *newsgroup_format_str (char *dest, ssize_t destlen, char op,
const char *src, const char *fmt,
const char *ifstring,
const char *elsestring,
(re, ((struct folder_file *) menu->data)[n].name, 0, NULL, 0));
}
-static void folder_entry (char *s, size_t slen, MUTTMENU * menu, int num)
+static void folder_entry (char *s, ssize_t slen, MUTTMENU * menu, int num)
{
FOLDER folder;
}
static void init_menu (struct browser_state *state, MUTTMENU * menu,
- char *title, size_t titlelen, int buffy)
+ char *title, ssize_t titlelen, int buffy)
{
char path[_POSIX_PATH_MAX];
return ff->tagged - ot;
}
-void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
+void _mutt_select_file (char *f, ssize_t flen, int flags, char ***files,
int *numfiles)
{
char buf[_POSIX_PATH_MAX];
url_parse_ciss (&url, state.entry[menu->current].name);
if (url.path &&
(state.entry[menu->current].delim != '\0') &&
- (n < sizeof (LastDir))) {
+ (n < ssizeof (LastDir))) {
LastDir[n] = '\0';
LastDir[n - 1] = state.entry[menu->current].delim;
}
if (multiple) {
char **tfiles;
int j;
- unsigned int h;
+ int h;
if (menu->tagged) {
*numfiles = menu->tagged;
if (!state.imap_browse)
{
/* add '/' at the end of the directory name if not already there */
- size_t len = m_strlen(LastDir);
+ ssize_t len = m_strlen(LastDir);
- if (len && LastDir[len - 1] != '/' && sizeof (buf) > len)
+ if (len && LastDir[len - 1] != '/' && ssizeof(buf) > len)
buf[len] = '/';
}
struct browser_state {
struct folder_file *entry;
- unsigned int entrylen; /* number of real entries */
- unsigned int entrymax; /* max entry */
+ int entrylen; /* number of real entries */
+ int entrymax; /* max entry */
short imap_browse;
char *folder;
unsigned noselect:1;
#endif
-void mutt_canonical_charset (char *dest, size_t dlen, const char *name)
+void mutt_canonical_charset (char *dest, ssize_t dlen, const char *name)
{
- size_t i;
+ ssize_t i;
char *p;
char scratch[LONG_STRING];
* if you're supplying an outrepl, the target charset should be.
*/
-size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t * inbytesleft,
- char **outbuf, size_t * outbytesleft,
+ssize_t mutt_iconv(iconv_t cd, const char **inbuf, ssize_t *inbytesleft,
+ char **outbuf, ssize_t *outbytesleft,
const char **inrepls, const char *outrepl)
{
- size_t ret = 0, ret1;
+ ssize_t ret = 0, ret1;
const char *ib = *inbuf;
- size_t ibl = *inbytesleft;
+ ssize_t ibl = *inbytesleft;
char *ob = *outbuf;
- size_t obl = *outbytesleft;
+ ssize_t obl = *outbytesleft;
for (;;) {
ret1 = my_iconv(cd, &ib, &ibl, &ob, &obl);
- if (ret1 != (size_t) - 1)
+ if (ret1 != -1)
ret += ret1;
if (ibl && obl && errno == EILSEQ) {
if (inrepls) {
for (t = inrepls; *t; t++) {
const char *ib1 = *t;
- size_t ibl1 = m_strlen(*t);
+ ssize_t ibl1 = m_strlen(*t);
char *ob1 = ob;
- size_t obl1 = obl;
+ ssize_t obl1 = obl;
my_iconv(cd, &ib1, &ibl1, &ob1, &obl1);
if (!ibl1) {
outrepl = "?";
my_iconv(cd, 0, 0, &ob, &obl);
if (obl) {
- size_t n = m_strlen(outrepl);
+ ssize_t n = m_strlen(outrepl);
if (n > obl) {
outrepl = "?";
int len;
const char *ib;
char *buf, *ob;
- size_t ibl, obl;
+ ssize_t ibl, obl;
const char **inrepls = NULL;
const char *outrepl = NULL;
char *p;
char *ob;
char *ib;
- size_t ibl;
+ ssize_t ibl;
const char **inrepls;
};
return (FGETCONV *) fc;
}
-char *fgetconvs (char *buf, size_t l, FGETCONV * _fc)
+char *fgetconvs (char *buf, ssize_t l, FGETCONV * _fc)
{
int c;
- size_t r;
+ ssize_t r;
for (r = 0; r + 1 < l;) {
if ((c = fgetconv (_fc)) == EOF)
/* Try to convert some more */
fc->p = fc->ob = fc->bufo;
if (fc->ibl) {
- size_t obl = sizeof (fc->bufo);
+ ssize_t obl = ssizeof(fc->bufo);
my_iconv(fc->cd, (const char **) &fc->ib, &fc->ibl, &fc->ob, &obl);
if (fc->p < fc->ob)
/* Try harder this time to convert some */
if (fc->ibl) {
- size_t obl = sizeof (fc->bufo);
+ ssize_t obl = ssizeof(fc->bufo);
mutt_iconv (fc->cd, (const char **) &fc->ib, &fc->ibl, &fc->ob,
&obl, fc->inrepls, 0);
return fcharset;
}
-static size_t convert_string (const char *f, size_t flen,
+static ssize_t convert_string (const char *f, ssize_t flen,
const char *from, const char *to,
- char **t, size_t * tlen)
+ char **t, ssize_t * tlen)
{
iconv_t cd;
char *buf, *ob;
- size_t obl;
+ ssize_t obl;
ssize_t n;
int e;
cd = mutt_iconv_open (to, from, 0);
if (cd == (iconv_t) (-1))
- return (size_t) (-1);
+ return -1;
obl = 4 * flen + 1;
ob = buf = xmalloc(obl);
n = my_iconv(cd, &f, &flen, &ob, &obl);
p_delete(&buf);
iconv_close (cd);
errno = e;
- return (size_t) (-1);
+ return -1;
}
*ob = '\0';
char *u = *ps;
char *s = NULL;
char *fromcode;
- size_t m, n;
- size_t ulen = m_strlen(*ps);
- size_t slen;
+ ssize_t m, n;
+ ssize_t ulen = m_strlen(*ps);
+ ssize_t slen;
if (!u || !*u)
return 0;
fromcode = p_dupstr(c, n);
m = convert_string (u, ulen, fromcode, Charset, &s, &slen);
p_delete(&fromcode);
- if (m != (size_t) (-1)) {
+ if (m != -1) {
p_delete(ps);
*ps = s;
return 0;
int mutt_convert_nonmime_string (char **);
iconv_t mutt_iconv_open (const char *, const char *, int);
-size_t mutt_iconv (iconv_t, const char **, size_t *, char **, size_t *,
- const char **, const char *);
+ssize_t mutt_iconv (iconv_t, const char **, ssize_t *, char **, ssize_t *,
+ const char **, const char *);
typedef void *FGETCONV;
FGETCONV *fgetconv_open (FILE *, const char *, const char *, int);
int fgetconv (FGETCONV *);
-char *fgetconvs (char *, size_t, FGETCONV *);
+char *fgetconvs (char *, ssize_t, FGETCONV *);
void fgetconv_close (FGETCONV **);
void mutt_set_langinfo_charset (void);
char prompt[SHORT_STRING];
char buf[HUGE_STRING] = { 0 };
address_t *adr = NULL;
- char *err = NULL;
+ const char *err = NULL;
int rc;
if (h)
*
* return 0 if ok, -1 if no matches
*/
-int mutt_complete (char *s, size_t slen)
+int mutt_complete (char *s, ssize_t slen)
{
char *p;
DIR *dirp = NULL;
struct dirent *de;
int i, init = 0;
- size_t len;
+ ssize_t len;
char dirpart[_POSIX_PATH_MAX], exp_dirpart[_POSIX_PATH_MAX];
char filepart[_POSIX_PATH_MAX];
}
else {
*p = 0;
- len = (size_t) (p - s);
+ len = p - s;
memcpy(dirpart, s, len);
dirpart[len] = 0;
p++;
static int edit_address_list (int line, address_t ** addr)
{
char buf[HUGE_STRING] = ""; /* needs to be large for alias expansion */
- char *err = NULL;
+ const char *err = NULL;
mutt_addrlist_to_local (*addr);
rfc822_write_address (buf, sizeof (buf), *addr, 0);
static unsigned long cum_attachs_size (MUTTMENU * menu)
{
- size_t s;
+ ssize_t s;
unsigned short i;
ATTACHPTR **idx = menu->data;
CONTENT *info;
* help when modifying this function.
*/
-static const char *compose_format_str (char *buf, size_t buflen, char op,
+static const char *compose_format_str (char *buf, ssize_t buflen, char op,
const char *src, const char *prefix,
const char *ifstring,
const char *elsestring,
*/
int mutt_compose_menu (HEADER * msg, /* structure for new message */
char *fcc, /* where to save a copy of the message */
- size_t fcclen, HEADER * cur)
+ ssize_t fcclen, HEADER * cur)
{ /* current message */
char helpstr[SHORT_STRING];
char buf[LONG_STRING];
struct stat sb;
time_t mtime = 0;
- size_t size = 0;
+ ssize_t size = 0;
mutt_mktemp (tmp);
* From [ <return-path> ] <weekday> <month> <day> <time> [ <timezone> ] <year>
*/
-int is_from (const char *s, char *path, size_t pathlen, time_t * tp)
+int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
{
struct tm tm;
int yr;
if (!is_day_name (s)) {
const char *p;
- size_t len;
+ ssize_t len;
short q = 0;
for (p = s; *p && (q || !ISSPACE (*p)); p++) {
return 0;
if (path) {
- len = (size_t) (p - s);
+ len = p - s;
if (len + 1 > pathlen)
len = pathlen - 1;
memcpy (path, s, len);
static void lazy_realloc(void *ptr, ssize_t siz)
{
- void **p = (void **) ptr;
+ char **p = ptr;
if (p != NULL && 0 < siz && siz < 4096) {
return;
}
- p_realloc(p, siz);
+ p_realloc(&p, siz);
}
static unsigned char *dump_int (unsigned int i, unsigned char *d, int *off)
}
-static int first_mailing_list (char *buf, size_t buflen, address_t * a)
+static int first_mailing_list (char *buf, ssize_t buflen, address_t * a)
{
for (; a; a = a->next) {
if (mutt_is_subscribed_list (a)) {
return 0;
}
-static void make_from (ENVELOPE * hdr, char *buf, size_t len, int do_lists)
+static void make_from (ENVELOPE * hdr, char *buf, ssize_t len, int do_lists)
{
int me;
*buf = 0;
}
-static void make_from_addr (ENVELOPE * hdr, char *buf, size_t len,
+static void make_from_addr (ENVELOPE * hdr, char *buf, ssize_t len,
int do_lists)
{
int me;
};
static const char *hdr_format_str (char *dest,
- size_t destlen,
+ ssize_t destlen,
char op,
const char *src,
const char *prefix,
#define THREAD_NEW (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 1)
#define THREAD_OLD (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 2)
- size_t len;
+ ssize_t len;
hdr = hfi->hdr;
ctx = hfi->ctx;
}
void
-_mutt_make_string (char *dest, size_t destlen, const char *s, CONTEXT * ctx,
+_mutt_make_string (char *dest, ssize_t destlen, const char *s, CONTEXT * ctx,
HEADER * hdr, format_flag flags)
{
struct hdr_format_info hfi;
void mutt_edit_headers (const char *editor,
const char *body,
- HEADER * msg, char *fcc, size_t fcclen)
+ HEADER * msg, char *fcc, ssize_t fcclen)
{
char path[_POSIX_PATH_MAX]; /* tempfile used to edit headers + body */
char buffer[LONG_STRING];
return (NULL);
}
-void mutt_make_help (char *d, size_t dlen, char *txt, int menu, int op)
+void mutt_make_help (char *d, ssize_t dlen, char *txt, int menu, int op)
{
char buf[SHORT_STRING];
d[0] = 0;
}
-char *mutt_compile_help (char *buf, size_t buflen, int menu,
+char *mutt_compile_help (char *buf, ssize_t buflen, int menu,
struct mapping_t *items)
{
int i;
- size_t len;
+ ssize_t len;
char *pbuf = buf;
for (i = 0; items[i].name && buflen > 2; i++) {
int n = maxwidth;
wchar_t wc;
int w;
- size_t k;
- size_t len = m_strlen(*macro);
+ ssize_t k;
+ ssize_t len = m_strlen(*macro);
mbstate_t mbstate1, mbstate2;
p_clear(&mbstate1, 1);
p_clear(&mbstate2, 1);
for (; len && (k = mbrtowc (&wc, *macro, len, &mbstate1));
*macro += k, len -= k) {
- if (k == (size_t) (-1) || k == (size_t) (-2)) {
- k = (k == (size_t) (-1)) ? 1 : len;
+ if (k == -1 || k == -2) {
+ k = (k == -1) ? 1 : len;
wc = replacement_char ();
}
/* glibc-2.1.3's wcwidth() returns 1 for unprintable chars! */
n -= w;
{
char buf[MB_LEN_MAX * 2];
- size_t n1, n2;
+ ssize_t n1, n2;
- if ((n1 = wcrtomb (buf, wc, &mbstate2)) != (size_t) (-1) &&
- (n2 = wcrtomb (buf + n1, 0, &mbstate2)) != (size_t) (-1))
+ if ((n1 = wcrtomb(buf, wc, &mbstate2)) != -1 &&
+ (n2 = wcrtomb(buf + n1, 0, &mbstate2)) != -1)
fputs (buf, f);
}
}
static unsigned long current_hook_type = 0;
-int mutt_parse_hook (BUFFER * buf __attribute__ ((unused)), BUFFER * s, unsigned long data,
- BUFFER * err)
+int mutt_parse_hook (BUFFER * buf __attribute__ ((unused)), BUFFER * s,
+ unsigned long data, BUFFER * err)
{
HOOK *ptr;
BUFFER command, pattern;
}
/* Deletes all hooks of type ``type'', or all defined hooks if ``type'' is 0 */
-static void delete_hooks (unsigned long type)
+static void delete_hooks (long type)
{
HOOK *h;
HOOK *prev;
}
static int
-mutt_addr_hook (char *path, size_t pathlen, unsigned long type, CONTEXT * ctx,
+mutt_addr_hook (char *path, ssize_t pathlen, unsigned long type, CONTEXT * ctx,
HEADER * hdr)
{
HOOK *hook;
return -1;
}
-void mutt_default_save (char *path, size_t pathlen, HEADER * hdr)
+void mutt_default_save (char *path, ssize_t pathlen, HEADER * hdr)
{
*path = 0;
if (mutt_addr_hook (path, pathlen, M_SAVEHOOK, Context, hdr) != 0) {
}
}
-void mutt_select_fcc (char *path, size_t pathlen, HEADER * hdr)
+void mutt_select_fcc (char *path, ssize_t pathlen, HEADER * hdr)
{
address_t *adr;
char buf[_POSIX_PATH_MAX];
/* append a delimiter if necessary */
n = m_strlen(buf);
- if (n && (n < sizeof (buf) - 1) && (buf[n - 1] != idata->delim)) {
+ if (n && (n < ssizeof (buf) - 1) && (buf[n - 1] != idata->delim)) {
buf[n++] = idata->delim;
buf[n] = '\0';
}
(state->entry)[state->entrylen].name = m_strdup(tmp);
/* mark desc with delim in browser if it can have subfolders */
- if (!isparent && !noinferiors && m_strlen(relpath) < sizeof (relpath) - 1) {
+ if (!isparent && !noinferiors && m_strlen(relpath) < ssizeof (relpath) - 1) {
relpath[m_strlen(relpath) + 1] = '\0';
relpath[m_strlen(relpath)] = delim;
}
/* trim dest to the length of the longest prefix it shares with src,
* returning the length of the trimmed string */
static int longest_common_prefix (char *dest, const char* src,
- int start, size_t dlen) {
+ int start, ssize_t dlen) {
int pos = start;
while (pos < dlen && dest[pos] && dest[pos] == src[pos])
/* look for IMAP URLs to complete from defined mailboxes. Could be extended
* to complete over open connections and account/folder hooks too. */
-static int imap_complete_hosts (char *dest, size_t len) {
+static int imap_complete_hosts (char *dest, ssize_t len) {
BUFFY* mailbox;
CONNECTION* conn;
int rc = -1;
IMAP_DATA *imap_new_idata (void);
void imap_free_idata (IMAP_DATA ** idata);
char *imap_fix_path (IMAP_DATA * idata, char *mailbox, char *path,
- size_t plen);
+ ssize_t plen);
int imap_get_literal_count (const char *buf, long *bytes);
char *imap_get_qualifier (char *buf);
char *imap_next_word (char *s);
((msgno + 1) >= fetchlast)));
if ((mfhrc < -1) || ((rc != IMAP_CMD_CONTINUE) && (rc != IMAP_CMD_OK))) {
- imap_free_header_data ((void **) &h.data);
+ imap_free_header_data((void *)&h.data);
fclose (fp);
mutt_hcache_close (hc);
return -1;
int uid;
int cacheno;
IMAP_CACHE *cache;
- int read;
+ int isread;
int rc;
progress_t bar;
if (ascii_strncasecmp ("UID", pc, 3) == 0) {
pc = imap_next_word (pc);
uid = atoi (pc);
- if (uid != HEADER_DATA (h)->uid)
+ if (uid != HEADER_DATA(h)->uid)
mutt_error (_
("The message index is incorrect. Try reopening the mailbox."));
}
* the server's notion of 'read' and if it differs from the message info
* picked up in mutt_read_rfc822_header, we mark the message (and context
* changed). Another possiblity: ignore Status on IMAP?*/
- read = h->read;
+ isread = h->read;
newenv = mutt_read_rfc822_header (msg->fp, h, 0, 0);
mutt_merge_envelopes(h->env, &newenv);
/* see above. We want the new status in h->read, so we unset it manually
* and let mutt_set_flag set it correctly, updating context. */
- if (read != h->read) {
- h->read = read;
- mutt_set_flag (ctx, h, M_NEW, read);
+ if (isread != h->read) {
+ h->read = isread;
+ mutt_set_flag (ctx, h, M_NEW, isread);
}
h->lines = 0;
/* -- data structures -- */
/* IMAP-specific header data, stored as HEADER->data */
typedef struct imap_header_data {
- unsigned int uid; /* 32-bit Message UID */
+ int uid; /* 32-bit Message UID */
string_list_t *keywords;
} IMAP_HEADER_DATA;
unsigned int replied:1;
unsigned int changed:1;
- unsigned int sid;
+ int sid;
IMAP_HEADER_DATA *data;
* Unicode characters above U+FFFF are replaced by U+FFFE.
* If input data is invalid, return 0 and don't store anything.
*/
-static char *utf8_to_utf7 (const char *u8, size_t u8len, char **u7,
- size_t * u7len)
+static char *utf8_to_utf7 (const char *u8, ssize_t u8len, char **u7,
+ ssize_t * u7len)
{
char *buf, *p;
int ch;
* Moreover, IMAP servers may dislike the path ending with the delimiter.
*/
char *imap_fix_path (IMAP_DATA * idata, char *mailbox, char *path,
- size_t plen)
+ ssize_t plen)
{
int x = 0;
*
*/
-static RETSIGTYPE alrm_handler (int sig)
+static RETSIGTYPE alrm_handler (int sig __attribute__((unused)))
{
/* empty */
}
static const struct mapping_t* get_sortmap (struct option_t* option);
static int parse_sort (struct option_t* dst, const char *s,
const struct mapping_t *map,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static HASH *ConfigOptions = NULL;
/* prototypes for checking for special vars */
static int check_dsn_return (const char* option, unsigned long val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static int check_dsn_notify (const char* option, unsigned long val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static int check_history (const char* option, unsigned long val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
/* this checks that numbers are >= 0 */
static int check_num (const char* option, unsigned long val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
#ifdef DEBUG
static int check_debug (const char* option, unsigned long val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
#endif
/* use this to check only */
static int check_special (const char* option, unsigned long val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
/* variable <-> sanity check function mappings
* when changing these, make sure the proper _from_string handler
static struct {
const char* name;
int (*check) (const char* option, unsigned long val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
} SpecialVars[] = {
{ "dsn_notify", check_dsn_notify },
{ "dsn_return", check_dsn_return },
};
/* protos for config type handles: convert value to string */
-static void bool_to_string (char* dst, size_t dstlen, struct option_t* option);
-static void num_to_string (char* dst, size_t dstlen, struct option_t* option);
-static void str_to_string (char* dst, size_t dstlen, struct option_t* option);
-static void quad_to_string (char* dst, size_t dstlen, struct option_t* option);
-static void sort_to_string (char* dst, size_t dstlen, struct option_t* option);
-static void rx_to_string (char* dst, size_t dstlen, struct option_t* option);
-static void magic_to_string (char* dst, size_t dstlen, struct option_t* option);
-static void addr_to_string (char* dst, size_t dstlen, struct option_t* option);
-static void user_to_string (char* dst, size_t dstlen, struct option_t* option);
-static void sys_to_string (char* dst, size_t dstlen, struct option_t* option);
+static void bool_to_string (char* dst, ssize_t dstlen, struct option_t* option);
+static void num_to_string (char* dst, ssize_t dstlen, struct option_t* option);
+static void str_to_string (char* dst, ssize_t dstlen, struct option_t* option);
+static void quad_to_string (char* dst, ssize_t dstlen, struct option_t* option);
+static void sort_to_string (char* dst, ssize_t dstlen, struct option_t* option);
+static void rx_to_string (char* dst, ssize_t dstlen, struct option_t* option);
+static void magic_to_string (char* dst, ssize_t dstlen, struct option_t* option);
+static void addr_to_string (char* dst, ssize_t dstlen, struct option_t* option);
+static void user_to_string (char* dst, ssize_t dstlen, struct option_t* option);
+static void sys_to_string (char* dst, ssize_t dstlen, struct option_t* option);
/* protos for config type handles: convert to value from string */
static int bool_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static int num_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static int str_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static int path_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static int quad_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static int sort_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static int rx_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static int magic_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static int addr_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static int user_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
static struct {
unsigned short type;
- void (*opt_to_string) (char* dst, size_t dstlen, struct option_t* option);
+ void (*opt_to_string) (char* dst, ssize_t dstlen, struct option_t* option);
int (*opt_from_string) (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen);
+ char* errbuf, ssize_t errlen);
} FuncTable[] = {
{ 0, NULL, NULL }, /* there's no DT_ type with 0 */
{ DT_BOOL, bool_to_string, bool_from_string },
{ DT_SYS, sys_to_string, NULL },
};
-static void bool_to_string (char* dst, size_t dstlen,
+static void bool_to_string (char* dst, ssize_t dstlen,
struct option_t* option) {
snprintf (dst, dstlen, "%s=%s", option->option,
option (option->data) ? "yes" : "no");
static int bool_from_string (struct option_t* dst, const char* val,
char* errbuf __attribute__ ((unused)),
- size_t errlen __attribute__ ((unused))) {
+ ssize_t errlen __attribute__ ((unused))) {
int flag = -1;
if (!dst)
return (1);
}
-static void num_to_string (char* dst, size_t dstlen,
+static void num_to_string (char* dst, ssize_t dstlen,
struct option_t* option) {
/* XXX puke */
const char* fmt = (m_strcmp(option->option, "umask") == 0) ?
}
static int num_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen) {
+ char* errbuf, ssize_t errlen) {
int num = 0, old = 0;
char* t = NULL;
return (1);
}
-static void str_to_string (char* dst, size_t dstlen,
+static void str_to_string (char* dst, ssize_t dstlen,
struct option_t* option) {
snprintf (dst, dstlen, "%s=\"%s\"", option->option,
NONULL (*((char**) option->data)));
}
-static void user_to_string (char* dst, size_t dstlen,
+static void user_to_string (char* dst, ssize_t dstlen,
struct option_t* option) {
snprintf (dst, dstlen, "%s=\"%s\"", option->option,
NONULL (((char*) option->data)));
}
-static void sys_to_string (char* dst, size_t dstlen,
+static void sys_to_string (char* dst, ssize_t dstlen,
struct option_t* option) {
char *val = NULL, *t = NULL;
int clean = 0;
}
static int path_from_string (struct option_t* dst, const char* val,
- char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
+ char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
char path[_POSIX_PATH_MAX];
if (!dst)
}
static int str_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen) {
+ char* errbuf, ssize_t errlen) {
if (!dst)
return (0);
}
static int user_from_string (struct option_t* dst, const char* val,
- char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
+ char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
/* if dst == NULL, we may get here in case the user did unset it,
* see parse_set() where item is free()'d before coming here; so
* just silently ignore it */
return (1);
}
-static void quad_to_string (char* dst, size_t dstlen,
+static void quad_to_string (char* dst, ssize_t dstlen,
struct option_t* option) {
const char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
snprintf (dst, dstlen, "%s=%s", option->option,
}
static int quad_from_string (struct option_t* dst, const char* val,
- char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
+ char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
int flag = -1;
if (!dst)
return (1);
}
-static void sort_to_string (char* dst, size_t dstlen,
+static void sort_to_string (char* dst, ssize_t dstlen,
struct option_t* option) {
const struct mapping_t *map = get_sortmap (option);
const char *p = NULL;
}
static int sort_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen) {
+ char* errbuf, ssize_t errlen) {
const struct mapping_t *map = NULL;
if (!(map = get_sortmap (dst))) {
if (errbuf)
return (1);
}
-static void rx_to_string (char* dst, size_t dstlen,
+static void rx_to_string (char* dst, ssize_t dstlen,
struct option_t* option) {
rx_t* p = (rx_t*) option->data;
snprintf (dst, dstlen, "%s=\"%s\"", option->option,
}
static int rx_from_string (struct option_t* dst, const char* val,
- char* errbuf, size_t errlen) {
+ char* errbuf, ssize_t errlen) {
rx_t* p = NULL;
regex_t* rx = NULL;
int flags = 0, e = 0, not = 0;
return (1);
}
-static void magic_to_string (char* dst, size_t dstlen,
+static void magic_to_string (char* dst, ssize_t dstlen,
struct option_t* option) {
const char* s = NULL;
switch (option->data) {
}
static int magic_from_string (struct option_t* dst, const char* val,
- char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
+ char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
int flag = -1;
if (!dst || !val || !*val)
}
-static void addr_to_string (char* dst, size_t dstlen,
+static void addr_to_string (char* dst, ssize_t dstlen,
struct option_t* option) {
char s[HUGE_STRING];
s[0] = '\0';
}
static int addr_from_string (struct option_t* dst, const char* val,
- char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
+ char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
if (!dst)
return (0);
address_list_wipe((address_t**) dst->data);
return (1);
}
-int mutt_option_value (const char* val, char* dst, size_t dstlen) {
+int mutt_option_value (const char* val, char* dst, ssize_t dstlen) {
struct option_t* option = NULL;
char* tmp = NULL, *t = NULL;
- size_t l = 0;
+ ssize_t l = 0;
if (!(option = hash_find (ConfigOptions, val))) {
debug_print (1, ("var '%s' not found\n", val));
{
alias_t *tmp = Aliases;
alias_t *last = NULL;
- char *estr = NULL;
+ const char *estr = NULL;
if (!MoreArgs (s)) {
m_strcpy(err->data, err->dsize, _("alias: no address"));
string_list_t *last = NULL;
string_list_t *tmp = UserHeader;
string_list_t *ptr;
- size_t l;
+ ssize_t l;
do {
mutt_extract_token (buf, s, 0);
BUFFER * err)
{
string_list_t *tmp;
- size_t keylen;
+ ssize_t keylen;
char *p;
mutt_extract_token (buf, s, M_TOKEN_SPACE | M_TOKEN_QUOTE);
static int
parse_sort (struct option_t* dst, const char *s, const struct mapping_t *map,
- char* errbuf, size_t errlen) {
+ char* errbuf, ssize_t errlen) {
int i, flags = 0;
if (m_strncmp("reverse-", s, 8) == 0) {
static int init_expand (char** dst, struct option_t* src) {
BUFFER token, in;
- size_t len = 0;
+ ssize_t len = 0;
p_delete(dst);
/* check whether value for $dsn_return would be valid */
static int check_dsn_return (const char* option __attribute__ ((unused)), unsigned long p,
- char* errbuf, size_t errlen) {
+ char* errbuf, ssize_t errlen) {
char* val = (char*) p;
if (val && *val && m_strncmp(val, "hdrs", 4) != 0 &&
m_strncmp(val, "full", 4) != 0) {
/* check whether value for $dsn_notify would be valid */
static int check_dsn_notify (const char* option, unsigned long p,
- char* errbuf, size_t errlen) {
+ char* errbuf, ssize_t errlen) {
list2_t* list = NULL;
- size_t i = 0;
+ ssize_t i = 0;
int rc = 1;
char* val = (char*) p;
}
static int check_num (const char* option, unsigned long p,
- char* errbuf, size_t errlen) {
+ char* errbuf, ssize_t errlen) {
if ((int) p < 0) {
if (errbuf)
snprintf (errbuf, errlen, _("'%d' is invalid for $%s"), (int) p, option);
#ifdef DEBUG
static int check_debug (const char* option, unsigned long p,
- char* errbuf, size_t errlen) {
+ char* errbuf, ssize_t errlen) {
if ((int) p <= DEBUG_MAX_LEVEL &&
(int) p >= DEBUG_MIN_LEVEL)
return (1);
#endif
static int check_history (const char* option __attribute__ ((unused)), unsigned long p,
- char* errbuf, size_t errlen) {
+ char* errbuf, ssize_t errlen) {
if (!check_num ("history", p, errbuf, errlen))
return (0);
mutt_init_history ();
}
static int check_special (const char* name, unsigned long val,
- char* errbuf, size_t errlen) {
+ char* errbuf, ssize_t errlen) {
int i = 0;
for (i = 0; SpecialVars[i].name; i++) {
hash_delete (ConfigOptions, option->option,
option, del_option);
else
- p_delete((void **)&option->data);
+ p_delete((void **)(void *)&option->data);
break;
}
}
BUFFER token;
char *linebuf = NULL;
char *currentline = NULL;
- size_t buflen;
+ ssize_t buflen;
pid_t pid;
debug_print (2, ("reading configuration file '%s'.\n", rcfile));
}
p_clear(&token, 1);
- while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL) {
+ while ((linebuf = mutt_read_line(linebuf, &buflen, f, &line)) != NULL) {
conv = ConfigCharset && (*ConfigCharset) && Charset;
if (conv) {
currentline = m_strdup(linebuf);
int Num_matched = 0; /* Number of matches for completion */
char Completed[STRING] = { 0 }; /* completed string (command or variable) */
-char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1]; /* all the matches + User_typed */
+const char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1]; /* all the matches + User_typed */
/* helper function for completion. Changes the dest buffer if
necessary/possible to aid completion.
}
}
-int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
+int mutt_command_complete (char *buffer, ssize_t len, int pos, int numtabs)
{
char *pt = buffer;
int num;
return 1;
}
-int mutt_var_value_complete (char *buffer, size_t len, int pos)
+int mutt_var_value_complete (char *buffer, ssize_t len, int pos)
{
char var[STRING], *pt = buffer;
int spaces;
else {
char tmp[LONG_STRING], tmp2[LONG_STRING];
char *s, *d;
- size_t dlen = buffer + len - pt - spaces;
+ ssize_t dlen = buffer + len - pt - spaces;
const char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
tmp[0] = '\0';
/* dump out the value of all the variables we have */
int mutt_dump_variables (int full) {
- size_t i = 0;
+ ssize_t i = 0;
char outbuf[STRING];
list2_t* tmp = NULL;
struct option_t* option = NULL;
} crypt_key_t;
typedef struct crypt_entry {
- size_t num;
+ ssize_t num;
crypt_key_t *key;
} crypt_entry_t;
/* Print the utf-8 encoded string BUF of length LEN bytes to stream
FP. Convert the character set. */
-static void print_utf8 (FILE * fp, const char *buf, size_t len)
+static void print_utf8 (FILE * fp, const char *buf, ssize_t len)
{
char *tstr;
{
gpgme_validity_t val = GPGME_VALIDITY_UNKNOWN;
gpgme_user_id_t uid = NULL;
- unsigned int is_strong = 0;
- unsigned int i = 0;
+ int is_strong = 0;
+ int i = 0;
if ((key->flags & KEYFLAG_ISX509))
return 1;
int err;
char tempfile[_POSIX_PATH_MAX];
FILE *fp;
- size_t nread = 0;
+ ssize_t nread = 0;
mutt_mktemp (tempfile);
fp = safe_fopen (tempfile, "w+");
do {
while (*s == ' ')
s++;
- for (i = 0; *s && *s != ' ' && i < sizeof (buf) - 1;)
+ for (i = 0; *s && *s != ' ' && i < ssizeof(buf) - 1;)
buf[i++] = *s++;
buf[i] = 0;
if (*buf) {
which must have been allocated by the caller with size BUFLEN.
Returns 0 on success or -1 in case of an error. The return string
is truncted to BUFLEN - 1. */
-static int get_micalg (gpgme_ctx_t ctx, char *buf, size_t buflen)
+static int get_micalg (gpgme_ctx_t ctx, char *buf, ssize_t buflen)
{
gpgme_sign_result_t result = NULL;
const char *algorithm_name = NULL;
if ((sum & GPGME_SIGSUM_SIG_EXPIRED)) {
gpgme_verify_result_t result;
gpgme_signature_t sig;
- unsigned int i;
+ int i;
result = gpgme_op_verify_result (ctx);
const char *t0 = NULL, *t1 = NULL;
gpgme_verify_result_t result;
gpgme_signature_t sig;
- unsigned int i;
+ int i;
state_attach_puts (_("A system error occurred"), s);
if (!badsig) {
gpgme_verify_result_t result;
gpgme_sig_notation_t notation;
- gpgme_signature_t signature;
+ gpgme_signature_t sig;
result = gpgme_op_verify_result (ctx);
if (result) {
- for (signature = result->signatures; signature;
- signature = signature->next) {
- if (signature->notations) {
+ for (sig = result->signatures; sig; sig = sig->next) {
+ if (sig->notations) {
state_attach_puts ("*** Begin Notation (signature by: ", s);
- state_attach_puts (signature->fpr, s);
+ state_attach_puts (sig->fpr, s);
state_attach_puts (") ***\n", s);
- for (notation = signature->notations; notation;
- notation = notation->next) {
+ for (notation = sig->notations; notation; notation = notation->next)
+ {
if (notation->name) {
state_attach_puts (notation->name, s);
state_attach_puts ("=", s);
{
struct stat info;
BODY *tattach;
- int err;
+ int err = 0;
gpgme_ctx_t ctx;
gpgme_data_t ciphertext, plaintext;
int maybe_signed = 0;
FILE *tmpfp = NULL;
int is_signed;
long saved_b_offset;
- size_t saved_b_length;
+ ssize_t saved_b_length;
int saved_b_type;
if (!mutt_is_application_smime (b))
* %[...] date of key using strftime(3)
*/
-static const char *crypt_entry_fmt (char *dest,
- size_t destlen,
- char op,
- const char *src,
- const char *prefix,
- const char *ifstring,
- const char *elsestring,
- unsigned long data, format_flag flags)
+static const char *
+crypt_entry_fmt (char *dest, ssize_t destlen, char op,
+ const char *src, const char *prefix,
+ const char *ifstring, const char *elsestring,
+ unsigned long data, format_flag flags)
{
char fmt[16];
crypt_entry_t *entry;
char buf2[SHORT_STRING], *p;
int do_locales;
struct tm *tm;
- size_t len;
+ ssize_t len;
p = dest;
s = "x";
else {
gpgme_user_id_t uid = NULL;
- unsigned int i = 0;
+ int i = 0;
for (i = 0, uid = key->kobj->uids; uid && (i < key->idx);
i++, uid = uid->next);
}
/* Used by the display fucntion to format a line. */
-static void crypt_entry (char *s, size_t l, MUTTMENU * menu, int num)
+static void crypt_entry (char *s, ssize_t l, MUTTMENU * menu, int num)
{
crypt_key_t **key_table = (crypt_key_t **) menu->data;
crypt_entry_t entry;
const unsigned char *string)
{
const unsigned char *s, *s1;
- size_t n;
+ ssize_t n;
unsigned char *p;
/* parse attributeType */
static struct dn_array_s *parse_dn (const unsigned char *string)
{
struct dn_array_s *array;
- size_t arrayidx, arraysize;
+ ssize_t arrayidx, arraysize;
int i;
arraysize = 7; /* C,ST,L,O,OU,CN,email */
string_list_t *l;
char *pattern, *p;
const char *s;
- size_t n;
+ ssize_t n;
n = 0;
for (l = list; l; l = l->next) {
escaped pappert but simple strings passed in an array to the
keylist_ext_start function. */
string_list_t *l;
- size_t n;
+ ssize_t n;
char **patarr;
for (l = hints, n = 0; l; l = l->next) {
else {
gpgme_validity_t val = GPGME_VALIDITY_UNKNOWN;
gpgme_user_id_t uid = NULL;
- unsigned int j = 0;
+ int j = 0;
warn_s = "??";
unsigned int app)
{
char *keyID, *keylist = NULL, *t;
- size_t keylist_size = 0;
- size_t keylist_used = 0;
+ ssize_t keylist_size = 0;
+ ssize_t keylist_used = 0;
address_t *tmp = NULL, *addr = NULL;
address_t **last = &tmp;
address_t *p, *q;
return gpgme_send_menu (msg, redraw, 1);
}
-static int verify_sender (HEADER * h, gpgme_protocol_t protocol)
+static int verify_sender (HEADER * h, gpgme_protocol_t protocol __attribute__((unused)))
{
address_t *sender = NULL;
unsigned int ret = 1;
if (PgpGoodSign.pattern) {
char *line = NULL;
int lineno = 0;
- size_t linelen;
+ ssize_t linelen;
while ((line = mutt_read_line (line, &linelen, fpin, &lineno)) != NULL) {
if (regexec (PgpGoodSign.rx, line, 0, NULL, 0) == 0) {
};
-const char *_mutt_fmt_pgp_command (char *dest,
- size_t destlen,
- char op,
- const char *src,
- const char *prefix,
- const char *ifstring,
- const char *elsestring,
- unsigned long data, format_flag flags)
+const char *
+_mutt_fmt_pgp_command(char *dest, ssize_t destlen,
+ char op, const char *src, const char *prefix,
+ const char *ifstring, const char *elsestring,
+ unsigned long data, format_flag flags)
{
char fmt[16];
struct pgp_command_context *cctx = (struct pgp_command_context *) data;
return (src);
}
-void mutt_pgp_command (char *d, size_t dlen, struct pgp_command_context *cctx,
+void mutt_pgp_command (char *d, ssize_t dlen, struct pgp_command_context *cctx,
const char *fmt)
{
mutt_FormatString (d, dlen, NONULL (fmt), _mutt_fmt_pgp_command,
*/
typedef struct pgp_entry {
- size_t num;
+ ssize_t num;
pgp_uid_t *uid;
} pgp_entry_t;
-static const char *pgp_entry_fmt (char *dest,
- size_t destlen,
- char op,
- const char *src,
- const char *prefix,
- const char *ifstring,
- const char *elsestring,
- unsigned long data, format_flag flags)
+static const char *
+pgp_entry_fmt (char *dest, ssize_t destlen, char op,
+ const char *src, const char *prefix,
+ const char *ifstring, const char *elsestring,
+ unsigned long data, format_flag flags)
{
char fmt[16];
pgp_entry_t *entry;
char buf2[SHORT_STRING], *p;
int do_locales;
struct tm *tm;
- size_t len;
+ ssize_t len;
p = dest;
return (src);
}
-static void pgp_entry (char *s, size_t l, MUTTMENU * menu, int num)
+static void pgp_entry (char *s, ssize_t l, MUTTMENU * menu, int num)
{
pgp_uid_t **KeyTable = (pgp_uid_t **) menu->data;
pgp_entry_t entry;
if (option (OPTPGPCHECKTRUST) &&
(!pgp_id_is_valid (KeyTable[menu->current])
|| !pgp_id_is_strong (KeyTable[menu->current]))) {
- const char *s = "";
+ const char *q = "";
char buff[LONG_STRING];
if (KeyTable[menu->current]->flags & KEYFLAG_CANTUSE)
- s = N_("ID is expired/disabled/revoked.");
+ q = N_("ID is expired/disabled/revoked.");
else
switch (KeyTable[menu->current]->trust & 0x03) {
case 0:
- s = N_("ID has undefined validity.");
+ q = N_("ID has undefined validity.");
break;
case 1:
- s = N_("ID is not valid.");
+ q = N_("ID is not valid.");
break;
case 2:
- s = N_("ID is only marginally valid.");
+ q = N_("ID is only marginally valid.");
break;
}
snprintf (buff, sizeof (buff),
- _("%s Do you really want to use the key?"), _(s));
+ _("%s Do you really want to use the key?"), _(q));
if (mutt_yesorno (buff, M_NO) != M_YES) {
mutt_clear_error ();
startpos = ftello (fp);
if (!plen) {
- pbuf = p_new(char, plen = CHUNKSIZE);
+ pbuf = p_new(unsigned char, plen = CHUNKSIZE);
}
if (fread (&ctb, 1, 1, fp) < 1) {
/* This is almost identical to ppgp's invoking interface. */
-static const char *_mutt_fmt_smime_command (char *dest,
- size_t destlen,
- char op,
- const char *src,
- const char *prefix,
- const char *ifstring,
- const char *elsestring,
- unsigned long data,
- format_flag flags)
+static const char *
+_mutt_fmt_smime_command (char *dest, ssize_t destlen, char op,
+ const char *src, const char *prefix,
+ const char *ifstring, const char *elsestring,
+ unsigned long data, format_flag flags)
{
char fmt[16];
struct smime_command_context *cctx = (struct smime_command_context *) data;
-static void mutt_smime_command (char *d, size_t dlen,
+static void mutt_smime_command (char *d, ssize_t dlen,
struct smime_command_context *cctx,
const char *fmt)
{
return certificate file name.
*/
-static void smime_entry (char *s, size_t l, MUTTMENU * menu, int num)
+static void smime_entry (char *s, ssize_t l, MUTTMENU * menu, int num)
{
smime_id *Table = (smime_id *) menu->data;
smime_id this = Table[num];
-char *smime_ask_for_key (char *prompt, char *mailbox, short public)
+char *smime_ask_for_key (char *prompt, char *mailbox __attribute__((unused)),
+ short public)
{
char *fname;
smime_id *Table;
long cert_num; /* Will contain the number of certificates.
* To be able to get it, the .index file will be read twice... */
char index_file[_POSIX_PATH_MAX];
- FILE *index;
+ FILE *idx;
char buf[LONG_STRING];
char fields[5][STRING];
int numFields, hash_suffix, done, cur; /* The current entry */
snprintf (index_file, sizeof (index_file), "%s/.index",
public ? NONULL (SmimeCertificates) : NONULL (SmimeKeys));
- index = fopen (index_file, "r");
- if (index == NULL) {
+ idx = fopen (index_file, "r");
+ if (idx == NULL) {
mutt_perror (index_file);
return NULL;
}
/* Count Lines */
cert_num = 0;
- while (!feof (index)) {
- if (fgets (buf, sizeof (buf), index))
+ while (!feof (idx)) {
+ if (fgets (buf, sizeof (buf), idx))
cert_num++;
}
- fclose (index);
+ fclose (idx);
for (;;) {
*qry = 0;
_("S/MIME certificates matching \"%s\"."), qry);
- index = fopen (index_file, "r");
- if (index == NULL) {
+ idx = fopen (index_file, "r");
+ if (idx == NULL) {
mutt_perror (index_file);
return NULL;
}
/* Read Entries */
cur = 0;
Table = p_new(smime_id, cert_num);
- while (!feof (index)) {
+ while (!feof (idx)) {
numFields =
- fscanf (index, MUTT_FORMAT (STRING) " %x.%i " MUTT_FORMAT (STRING),
+ fscanf (idx, MUTT_FORMAT (STRING) " %x.%i " MUTT_FORMAT (STRING),
fields[0], &hash, &hash_suffix, fields[2]);
if (public)
- fscanf (index, MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) "\n",
+ fscanf (idx, MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) "\n",
fields[3], fields[4]);
/* 0=email 1=name 2=nick 3=intermediate 4=trust */
cur++;
}
- fclose (index);
+ fclose (idx);
/* Make Helpstring */
helpstr[0] = 0;
char *smime_findKeys (address_t * to, address_t * cc, address_t * bcc)
{
char *keyID, *keylist = NULL;
- size_t keylist_size = 0;
- size_t keylist_used = 0;
+ ssize_t keylist_size = 0;
+ ssize_t keylist_used = 0;
address_t *tmp = NULL, *addr = NULL;
address_t **last = &tmp;
address_t *p, *q;
/* Add a certificate and update index file (externally). */
-void smime_invoke_import (char *infile, char *mailbox)
+void smime_invoke_import (char *infile, char *mailbox __attribute__((notused)))
{
char tmpfname[_POSIX_PATH_MAX], *certfile = NULL, buf[STRING];
FILE *smimein = NULL, *fpout = NULL, *fperr = NULL;
int badsig = -1;
long tmpoffset = 0;
- size_t tmplength = 0;
+ ssize_t tmplength = 0;
int origType = sigbdy->type;
char *savePrefix = NULL;
else {
char *line = NULL;
int lineno = 0;
- size_t linelen;
+ ssize_t linelen;
fflush (smimeerr);
rewind (smimeerr);
if (type & SIGNOPAQUE) {
char *line = NULL;
int lineno = 0;
- size_t linelen;
+ ssize_t linelen;
rewind (smimeerr);
char tempfile[_POSIX_PATH_MAX];
STATE s;
long tmpoffset = b->offset;
- size_t tmplength = b->length;
+ ssize_t tmplength = b->length;
int origType = b->type;
FILE *tmpfp = NULL;
int rv = 0;
/* dynamically grows a BUFFER to accomodate s, in increments of 128 bytes.
* Always one byte bigger than necessary for the null terminator, and
* the buffer is always null-terminated */
-void mutt_buffer_add(BUFFER *buf, const char *s, size_t len)
+void mutt_buffer_add(BUFFER *buf, const char *s, ssize_t len)
{
size_t offset;
FILE *fp;
pid_t pid;
char *cmd, *ptr;
- size_t expnlen;
+ ssize_t expnlen;
BUFFER expn;
int line = 0;
typedef struct {
char *data; /* pointer to data */
char *dptr; /* current read/write position */
- size_t dsize; /* length of data */
+ ssize_t dsize; /* length of data */
int destroy; /* destroy `data' when done? */
} BUFFER;
BUFFER *mutt_buffer_from(BUFFER *, const char *);
int mutt_extract_token(BUFFER *, BUFFER *, int);
-void mutt_buffer_add(BUFFER *, const char *, size_t);
+void mutt_buffer_add(BUFFER *, const char *, ssize_t);
static inline void mutt_buffer_addstr(BUFFER *b, const char *s) {
mutt_buffer_add(b, s, m_strlen(s));
}
* If a line ends with "\", this char and the linefeed is removed,
* and the next line is read too.
*/
-char *mutt_read_line(char *s, size_t *size, FILE * fp, int *line)
+char *mutt_read_line(char *s, ssize_t *size, FILE * fp, int *line)
{
- size_t offset = 0;
+ ssize_t offset = 0;
char *ch;
if (!s) {
char buf[BUFSIZ];
size_t l;
- while ((l = fread(buf, 1, sizeof (buf), fin)) > 0) {
+ while ((l = fread(buf, 1, sizeof(buf), fin)) > 0) {
if (fwrite(buf, 1, l, fout) != l)
return -1;
}
return 0;
}
-int mutt_copy_bytes(FILE *in, FILE *out, size_t size)
+int mutt_copy_bytes(FILE *in, FILE *out, ssize_t size)
{
char buf[BUFSIZ];
while (size > 0) {
- size_t chunk = MIN(size, sizeof(buf));
+ size_t chunk = MIN(size, ssizeof(buf));
if ((chunk = fread(buf, 1, chunk, in)) < 1)
break;
FILE *safe_fopen(const char *, const char *);
int safe_fclose(FILE **);
-char *mutt_read_line(char *, size_t *, FILE *, int *);
+char *mutt_read_line(char *, ssize_t *, FILE *, int *);
int mutt_copy_stream(FILE *, FILE *);
-int mutt_copy_bytes(FILE *, FILE *, size_t);
+int mutt_copy_bytes(FILE *, FILE *, ssize_t);
/****************************************************************************/
/* ligben-like funcs */
return rc;
}
-int mutt_socket_read (CONNECTION * conn, char *buf, size_t len)
+int mutt_socket_read (CONNECTION * conn, char *buf, ssize_t len)
{
int rc;
return close (conn->fd);
}
-int raw_socket_read (CONNECTION * conn, char *buf, size_t len)
+int raw_socket_read (CONNECTION * conn, char *buf, ssize_t len)
{
int rc;
return rc;
}
-int raw_socket_write (CONNECTION * conn, const char *buf, size_t count)
+int raw_socket_write (CONNECTION * conn, const char *buf, ssize_t count)
{
int rc;
struct _connection *next;
void *sockdata;
- int (*conn_read) (struct _connection * conn, char *buf, size_t len);
+ int (*conn_read) (struct _connection * conn, char *buf, ssize_t len);
int (*conn_write) (struct _connection * conn, const char *buf,
- size_t count);
+ ssize_t count);
int (*conn_open) (struct _connection * conn);
int (*conn_close) (struct _connection * conn);
} CONNECTION;
int mutt_socket_open (CONNECTION * conn);
int mutt_socket_close (CONNECTION * conn);
-int mutt_socket_read (CONNECTION * conn, char *buf, size_t len);
+int mutt_socket_read (CONNECTION * conn, char *buf, ssize_t len);
int mutt_socket_readchar (CONNECTION * conn, char *c);
#define mutt_socket_readln(A,B,C) mutt_socket_readln_d(A,B,C,M_SOCK_LOG_CMD)
CONNECTION *mutt_conn_find (const CONNECTION * start,
const ACCOUNT * account);
-int raw_socket_read (CONNECTION * conn, char *buf, size_t len);
-int raw_socket_write (CONNECTION * conn, const char *buf, size_t count);
+int raw_socket_read (CONNECTION * conn, char *buf, ssize_t len);
+int raw_socket_write (CONNECTION * conn, const char *buf, ssize_t count);
int raw_socket_open (CONNECTION * conn);
int raw_socket_close (CONNECTION * conn);
} tlssockdata;
/* local prototypes */
-static int tls_socket_read (CONNECTION * conn, char *buf, size_t len);
-static int tls_socket_write (CONNECTION * conn, const char *buf, size_t len);
+static int tls_socket_read (CONNECTION * conn, char *buf, ssize_t len);
+static int tls_socket_write (CONNECTION * conn, const char *buf, ssize_t len);
static int tls_socket_open (CONNECTION * conn);
static int tls_socket_close (CONNECTION * conn);
static int tls_starttls_close (CONNECTION * conn);
return 0;
}
-static int tls_socket_read (CONNECTION * conn, char *buf, size_t len)
+static int tls_socket_read (CONNECTION * conn, char *buf, ssize_t len)
{
tlssockdata *data = conn->sockdata;
int ret;
return ret;
}
-static int tls_socket_write (CONNECTION * conn, const char *buf, size_t len)
+static int tls_socket_write (CONNECTION * conn, const char *buf, ssize_t len)
{
tlssockdata *data = conn->sockdata;
int ret;
char *s, int l, const gnutls_datum * data)
{
unsigned char md[36];
- size_t n;
+ ssize_t n;
int j;
n = 36;
- if (gnutls_fingerprint (algo, data, (char *) md, &n) < 0) {
+ if (gnutls_fingerprint(algo, data, (char *) md, &n) < 0) {
snprintf (s, l, _("[unable to calculate]"));
}
else {
}
}
-static char *tls_make_date (time_t t, char *s, size_t len)
+static char *tls_make_date (time_t t, char *s, ssize_t len)
{
struct tm *l = gmtime (&t);
char buf[80];
FILE *fp;
char *linestr = NULL;
- size_t linestrsize;
+ ssize_t linestrsize;
int linenum = 0;
regex_t preg;
regmatch_t pmatch[3];
char helpstr[SHORT_STRING];
char buf[SHORT_STRING];
char fpbuf[SHORT_STRING];
- size_t buflen;
+ ssize_t buflen;
char dn_common_name[SHORT_STRING];
char dn_email[SHORT_STRING];
char dn_organization[SHORT_STRING];
* is impossible to unget function keys in SLang, so roll our own input
* buffering routines.
*/
-size_t UngetCount = 0;
-static size_t UngetBufLen = 0;
+ssize_t UngetCount = 0;
+static ssize_t UngetBufLen = 0;
static event_t *KeyEvent;
void mutt_refresh (void)
return (ch == ctrl ('G') ? err : ret);
}
-int _mutt_get_field ( const char *field, char *buf, size_t buflen,
+int _mutt_get_field ( const char *field, char *buf, ssize_t buflen,
int complete, int multiple, char ***files, int *numfiles)
{
int ret;
return (ret);
}
-int mutt_get_field_unbuffered (char *msg, char *buf, size_t buflen, int flags)
+int mutt_get_field_unbuffered (char *msg, char *buf, ssize_t buflen, int flags)
{
int rc;
char *yes = _("yes");
char *no = _("no");
char *answer_string;
- size_t answer_string_len;
+ ssize_t answer_string_len;
#ifdef HAVE_LANGINFO_YESEXPR
char *expr;
return rc;
}
-int _mutt_enter_fname (const char *prompt, char *buf, size_t blen,
+int _mutt_enter_fname (const char *prompt, char *buf, ssize_t blen,
int *redraw, int buffy, int multiple, char ***files,
int *numfiles)
{
{
char buf[MB_LEN_MAX * 2];
mbstate_t mbstate;
- size_t n1, n2;
+ ssize_t n1, n2;
p_clear(&mbstate, 1);
- if ((n1 = wcrtomb (buf, wc, &mbstate)) == (size_t) (-1) ||
- (n2 = wcrtomb (buf + n1, 0, &mbstate)) == (size_t) (-1))
+ if ((n1 = wcrtomb(buf, wc, &mbstate)) == -1 ||
+ (n2 = wcrtomb(buf + n1, 0, &mbstate)) == -1)
return -1; /* ERR */
else
return addstr (buf);
* the number of character cells when printed.
*/
-static void mutt_format_s_x (char *dest,
- size_t destlen,
+static void mutt_format_s_x (char *dest, ssize_t destlen,
const char *prefix, const char *s, int arboreal)
{
int right_justify = 1;
right_justify, ' ', s, m_strlen(s), arboreal);
}
-void mutt_format_s (char *dest,
- size_t destlen, const char *prefix, const char *s)
+void mutt_format_s (char *dest, ssize_t destlen,
+ const char *prefix, const char *s)
{
mutt_format_s_x (dest, destlen, prefix, s, 0);
}
-void mutt_format_s_tree (char *dest,
- size_t destlen, const char *prefix, const char *s)
+void mutt_format_s_tree (char *dest, ssize_t destlen,
+ const char *prefix, const char *s)
{
mutt_format_s_x (dest, destlen, prefix, s, 1);
}
{
wchar_t wc;
int w;
- size_t k;
- size_t len = m_strlen(s);
+ ssize_t k;
+ ssize_t len = m_strlen(s);
mbstate_t mbstate;
p_clear(&mbstate, 1);
for (; len && (k = mbrtowc (&wc, s, len, &mbstate)); s += k, len -= k) {
- if (k == (size_t) (-1) || k == (size_t) (-2)) {
- k = (k == (size_t) (-1)) ? 1 : len;
+ if (k == -1 || k == -2) {
+ k = (k == -1) ? 1 : len;
wc = replacement_char ();
}
if (!IsWPrint (wc))
{
wchar_t wc;
int w;
- size_t k, n;
+ ssize_t k, n;
mbstate_t mbstate;
if (!s)
p_clear(&mbstate, 1);
for (w = 0; n && (k = mbrtowc (&wc, s, n, &mbstate)); s += k, n -= k) {
- if (k == (size_t) (-1) || k == (size_t) (-2)) {
- k = (k == (size_t) (-1)) ? 1 : n;
+ if (k == -1 || k == -2) {
+ k = (k == -1) ? 1 : n;
wc = replacement_char ();
}
if (!IsWPrint (wc))
#define MAIN_C 1
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#endif
#ifdef USE_HCACHE
-#if HAVE_QDBM
+#if defined(HAVE_QDBM)
#include <depot.h>
-#elif HAVE_GDBM
+#elif defined(HAVE_GDBM)
#include <gdbm.h>
-#elif HAVE_DB4
+#elif defined(HAVE_DB4)
#include <db.h>
#endif
#endif
#endif
#ifdef USE_HCACHE
-#if HAVE_QDBM
+#if defined(HAVE_QDBM)
printf (" qdbm %s\n", dpversion);
-#elif HAVE_GDBM
+#elif defined(HAVE_GDBM)
printf (" gdbm %s\n", gdbm_version);
-#elif HAVE_DB4
+#elif defined(HAVE_DB4)
printf (" DB4 %d.%d.%d\n", DB_VERSION_MAJOR, DB_VERSION_MINOR,
DB_VERSION_PATCH);
#endif
"-HAVE_LANGINFO_YESEXPR "
#endif
"\n "
-#if HAVE_ICONV
+#ifdef HAVE_ICONV
"+HAVE_ICONV "
#else
"-HAVE_ICONV "
#else
"-ICONV_NONTRANS "
#endif
-#if HAVE_LIBIDN
+#ifdef HAVE_LIBIDN
"+HAVE_LIBIDN "
#else
"-HAVE_LIBIDN "
#endif
-#if HAVE_GETSID
+#ifdef HAVE_GETSID
"+HAVE_GETSID "
#else
"-HAVE_GETSID "
#endif
-#if HAVE_GETADDRINFO
+#ifdef HAVE_GETADDRINFO
"+HAVE_GETADDRINFO "
#else
"-HAVE_GETADDRINFO "
keypad (stdscr, TRUE);
cbreak ();
noecho ();
-#if HAVE_TYPEAHEAD
+#ifdef HAVE_TYPEAHEAD
typeahead (-1); /* simulate smooth scrolling */
#endif
-#if HAVE_META
+#ifdef HAVE_META
meta (stdscr, TRUE);
#endif
}
int dump_variables = -1;
/* initialize random number for tmp file creation */
- srand ((unsigned int) time (NULL));
+ srand48((unsigned int) time (NULL));
/* sanity check against stupid administrators */
mutt_error = mutt_nocurses_error;
mutt_message = mutt_nocurses_error;
- SRAND (time (NULL));
+ srand48 (time (NULL));
umask (077);
p_clear(Options, countof(Options));
address_t *a;
for (; alias_queries; alias_queries = alias_queries->next) {
- if ((a = alias_lookup(alias_queries->data))) {
+ if ((a = address_list_dup(alias_lookup(alias_queries->data)))) {
/* output in machine-readable form */
mutt_addrlist_to_idna (a, NULL);
mutt_write_address_list (a, stdout, 0, 0);
- }
- else {
+ address_list_wipe(&a);
+ } else {
rv = 1;
printf ("%s\n", alias_queries->data);
}
#ifdef USE_HCACHE
static size_t maildir_hcache_keylen (const char *fn)
{
- const char *p = strchr (fn, ':');
-
- return p ? (size_t) (p - fn) : m_strlen(fn);
+ return m_strchrnul(fn, ':') - fn;
}
#endif
/* socket wrappers for a SASL security layer */
static int mutt_sasl_conn_open (CONNECTION * conn);
static int mutt_sasl_conn_close (CONNECTION * conn);
-static int mutt_sasl_conn_read (CONNECTION * conn, char *buf, size_t len);
+static int mutt_sasl_conn_read (CONNECTION * conn, char *buf, ssize_t len);
static int mutt_sasl_conn_write (CONNECTION * conn, const char *buf,
- size_t count);
+ ssize_t count);
/* utility function, stolen from sasl2 sample code */
static int iptostring (const struct sockaddr *addr, socklen_t addrlen,
return rc;
}
-static int mutt_sasl_conn_read (CONNECTION * conn, char *buf, size_t len)
+static int mutt_sasl_conn_read (CONNECTION * conn, char *buf, ssize_t len)
{
SASL_DATA *sasldata;
int rc;
}
static int mutt_sasl_conn_write (CONNECTION * conn, const char *buf,
- size_t len)
+ ssize_t len)
{
SASL_DATA *sasldata;
int rc;
void *sockdata;
int (*msasl_open) (CONNECTION * conn);
int (*msasl_close) (CONNECTION * conn);
- int (*msasl_read) (CONNECTION * conn, char *buf, size_t len);
- int (*msasl_write) (CONNECTION * conn, const char *buf, size_t count);
+ int (*msasl_read) (CONNECTION * conn, char *buf, ssize_t len);
+ int (*msasl_write) (CONNECTION * conn, const char *buf, ssize_t count);
} SASL_DATA;
#endif /* _MUTT_SASL_H_ */
* Renamed to mutt_adv_mktemp so I only have to change where it's
* called, and not all possible cases.
*/
-void mutt_adv_mktemp (const char* dir, char *s, size_t l)
+void mutt_adv_mktemp (const char* dir, char *s, ssize_t l)
{
char buf[_POSIX_PATH_MAX];
char tmp[_POSIX_PATH_MAX];
char *period;
- size_t sl;
+ ssize_t sl;
struct stat sb;
m_strcpy(buf, sizeof(buf), m_strisempty(dir) ? NONULL(Tempdir) : dir);
void mutt_expand_link (char *newpath, const char *path, const char *lnk)
{
const char *lb = NULL;
- size_t len;
+ ssize_t len;
/* lnk is full path */
if (*lnk == '/') {
m_strcpy(newpath + len, _POSIX_PATH_MAX - len, lnk);
}
-char *mutt_expand_path (char *s, size_t slen)
+char *mutt_expand_path (char *s, ssize_t slen)
{
return _mutt_expand_path (s, slen, 0);
}
-char *_mutt_expand_path (char *s, size_t slen, int rx)
+char *_mutt_expand_path (char *s, ssize_t slen, int rx)
{
char p[_POSIX_PATH_MAX] = "";
char q[_POSIX_PATH_MAX] = "";
case '@':
{
HEADER *h;
+ /* FIXME: BUG ? */
address_t *alias;
if ((alias = alias_lookup(s + 1))) {
void mutt_pretty_mailbox (char *s)
{
char *p = s, *q = s;
- size_t len;
+ ssize_t len;
url_scheme_t scheme;
scheme = url_check_scheme (s);
}
}
-void mutt_pretty_size (char *s, size_t len, long n)
+void mutt_pretty_size (char *s, ssize_t len, long n)
{
if (n == 0)
m_strcpy(s, len, "0K");
}
}
-void mutt_expand_file_fmt (char *dest, size_t destlen, const char *fmt,
+void mutt_expand_file_fmt (char *dest, ssize_t destlen, const char *fmt,
const char *src)
{
char tmp[LONG_STRING];
mutt_expand_fmt (dest, destlen, fmt, tmp);
}
-void mutt_expand_fmt (char *dest, size_t destlen, const char *fmt,
+void mutt_expand_fmt (char *dest, ssize_t destlen, const char *fmt,
const char *src)
{
const char *p;
char *d;
- size_t slen;
+ ssize_t slen;
int found = 0;
slen = m_strlen(src);
/* return 0 on success, -1 on abort, 1 on error */
int mutt_check_overwrite (const char *attname, const char *path,
- char *fname, size_t flen, int *append,
+ char *fname, ssize_t flen, int *append,
char **directory)
{
int rc = 0;
return 0;
}
-void mutt_save_path (char *d, size_t dsize, address_t * a)
+void mutt_save_path (char *d, ssize_t dsize, address_t * a)
{
if (a && a->mailbox) {
m_strcpy(d, dsize, a->mailbox);
*d = 0;
}
-void mutt_safe_path (char *s, size_t l, address_t * a)
+void mutt_safe_path (char *s, ssize_t l, address_t * a)
{
char *p;
}
/* Does this pattern match? */
- if (regexec
- (l->rx->rx, s, (size_t) l->nmatch, (regmatch_t *) pmatch,
- (int) 0) == 0) {
+ if (regexec(l->rx->rx, s, l->nmatch, (regmatch_t *)pmatch, (int) 0) == 0)
+ {
debug_print (5, ("%s matches %s\n%d subst", s, l->rx->pattern, l->rx->rx->re_nsub));
/* Copy template into text, with substitutions. */
/* Args:
* excl if excl != 0, request an exclusive lock
* dot if dot != 0, try to dotlock the file
- * timeout should retry locking?
+ * time_out should retry locking?
*/
-int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
+int mx_lock_file (const char *path, int fd, int excl, int dot, int time_out)
{
#if defined (USE_FCNTL) || defined (USE_FLOCK)
int count;
/* only unlock file if it is unchanged */
if (prev_sb.st_size == sb.st_size
- && ++count >= (timeout ? MAXLOCKATTEMPT : 0)) {
- if (timeout)
+ && ++count >= (time_out ? MAXLOCKATTEMPT : 0)) {
+ if (time_out)
mutt_error _("Timeout exceeded while attempting fcntl lock!");
return (-1);
/* only unlock file if it is unchanged */
if (prev_sb.st_size == sb.st_size
- && ++count >= (timeout ? MAXLOCKATTEMPT : 0)) {
- if (timeout)
+ && ++count >= (time_out ? MAXLOCKATTEMPT : 0)) {
+ if (time_out)
mutt_error _("Timeout exceeded while attempting flock lock!");
r = -1;
#ifdef USE_DOTLOCK
if (r == 0 && dot)
- r = dotlock_file (path, fd, timeout);
+ r = dotlock_file (path, fd, time_out);
#endif /* USE_DOTLOCK */
if (r == -1) {
char group[LONG_STRING];
int x = 1;
char *p = line, *b, *h;
- size_t len;
+ ssize_t len;
while (*p) {
if (*p++ == ',')
struct stat st;
char buf[HUGE_STRING], *cp;
char dir[_POSIX_PATH_MAX], file[_POSIX_PATH_MAX];
- FILE *index;
+ FILE *idx;
NNTP_DATA *data;
int l, m, t;
p_delete(&news->cache);
snprintf (buf, sizeof (buf), "%s/.index", dir);
- if (!(index = safe_fopen (buf, "a+")))
+ if (!(idx = safe_fopen (buf, "a+")))
return 0;
- rewind (index);
- while (fgets (buf, sizeof (buf), index)) {
+ rewind (idx);
+ while (fgets (buf, sizeof (buf), idx)) {
buf[m_strlen(buf) - 1] = 0; /* strip ending '\n' */
if (!m_strncmp(buf, "#: ", 3) &&
!m_strcasecmp(buf + 3, news->conn->account.host))
break;
}
- while (fgets (buf, sizeof (buf), index)) {
+ while (fgets (buf, sizeof (buf), idx)) {
cp = buf;
while (*cp && *cp != ' ')
cp++;
mutt_newsgroup_stat (data);
}
}
- fclose (index);
+ fclose (idx);
return 0;
}
-const char *nntp_format_str (char *dest, size_t destlen, char op,
+const char *nntp_format_str (char *dest, ssize_t destlen, char op,
const char *src, const char *fmt,
const char *ifstring, const char *elsestring,
unsigned long data, format_flag flags)
/* nntp_parse_url: given an NNPT URL, return host, port,
* username, password and newsgroup will recognise. */
-int nntp_parse_url (const char *server, ACCOUNT * acct,
- char *group, size_t group_len)
+int nntp_parse_url (const char *server, ACCOUNT * act,
+ char *group, ssize_t group_len)
{
ciss_url_t url;
char *c;
int ret = -1;
/* Defaults */
- acct->flags = 0;
- acct->port = NNTP_PORT;
- acct->type = M_ACCT_TYPE_NNTP;
+ act->flags = 0;
+ act->port = NNTP_PORT;
+ act->type = M_ACCT_TYPE_NNTP;
c = m_strdup(server);
url_parse_ciss (&url, c);
if (url.scheme == U_NNTP || url.scheme == U_NNTPS) {
if (url.scheme == U_NNTPS) {
- acct->flags |= M_ACCT_SSL;
- acct->port = NNTP_SSL_PORT;
+ act->flags |= M_ACCT_SSL;
+ act->port = NNTP_SSL_PORT;
}
*group = '\0';
if (url.path)
m_strcpy(group, group_len, url.path);
- ret = mutt_account_fromurl (acct, &url);
+ ret = mutt_account_fromurl (act, &url);
}
p_delete(&c);
return ret;
}
-void nntp_expand_path (char *line, size_t len, ACCOUNT * acct)
+void nntp_expand_path (char *line, ssize_t len, ACCOUNT * act)
{
ciss_url_t url;
url.path = m_strdup(line);
- mutt_account_tourl (acct, &url);
+ mutt_account_tourl (act, &url);
url_ciss_tostring (&url, line, len, 0);
p_delete(&url.path);
}
char file[_POSIX_PATH_MAX];
char *buf, *p;
string_list_t *list;
- ACCOUNT acct;
+ ACCOUNT act;
NNTP_SERVER *serv;
CONNECTION *conn;
- p_clear(&acct, 1);
+ p_clear(&act, 1);
if (!server || !*server) {
mutt_error _("No newsserver defined!");
}
strcpy (p, server);
- if ((nntp_parse_url (buf, &acct, file, sizeof (file))) < 0 || *file) {
+ if ((nntp_parse_url (buf, &act, file, sizeof (file))) < 0 || *file) {
p_delete(&buf);
mutt_error (_("%s is an invalid newsserver specification!"), server);
return NULL;
}
p_delete(&buf);
- conn = mutt_conn_find (NULL, &acct);
+ conn = mutt_conn_find (NULL, &act);
if (!conn)
return NULL;
}
static void nntp_create_newsrc_line (NNTP_DATA * data, char **buf,
- char **pline, size_t * buflen)
+ char **pline, ssize_t * buflen)
{
char *line = *pline;
- size_t len = *buflen - (*pline - *buf);
+ ssize_t len = *buflen - (*pline - *buf);
int x, i;
if (len < LONG_STRING * 10) {
NNTP_DATA *data;
string_list_t *tmp;
int r = -1;
- size_t len, llen;
+ ssize_t len, llen;
if (!news)
return -1;
}
/* this routine gives the first newsgroup with new messages */
-void nntp_buffy (char* dst, size_t dstlen) {
+void nntp_buffy (char* dst, ssize_t dstlen) {
string_list_t *list;
int count = 0;
m_strcpy(inbuf + lenbuf, sizeof(buf), p);
pos += chunk;
- if (chunk >= sizeof (buf)) {
+ if (chunk >= ssizeof (buf)) {
lenbuf += m_strlen(p);
}
else {
char server[LONG_STRING];
int count = 0;
unsigned int first;
- ACCOUNT acct;
+ ACCOUNT act;
- p_clear(&acct, 1);
+ p_clear(&act, 1);
- if (nntp_parse_url (ctx->path, &acct, buf, sizeof (buf)) < 0 || !*buf) {
+ if (nntp_parse_url (ctx->path, &act, buf, sizeof (buf)) < 0 || !*buf) {
mutt_error (_("%s is an invalid newsgroup specification!"), ctx->path);
mutt_sleep (2);
return -1;
}
server[0] = '\0';
- nntp_expand_path (server, sizeof (server), &acct);
+ nntp_expand_path (server, sizeof (server), &act);
if (!(serv = mutt_select_newsserver (server)) || serv->status != NNTP_OK)
return -1;
int nntp_save_cache_index (NNTP_SERVER *);
int nntp_check_newgroups (NNTP_SERVER *, int);
int nntp_save_cache_group (CONTEXT *);
-int nntp_parse_url (const char *, ACCOUNT *, char *, size_t);
+int nntp_parse_url (const char *, ACCOUNT *, char *, ssize_t);
void newsrc_gen_entries (CONTEXT *);
void nntp_get_status (CONTEXT *, HEADER *, char *, int);
void mutt_newsgroup_stat (NNTP_DATA *);
int nntp_post (const char *);
int nntp_check_msgid (CONTEXT *, const char *);
int nntp_check_children (CONTEXT *, const char *);
-void nntp_buffy (char* dst, size_t dstlen);
-void nntp_expand_path (char *, size_t, ACCOUNT *);
+void nntp_buffy (char* dst, ssize_t dstlen);
+void nntp_expand_path (char *, ssize_t, ACCOUNT *);
void nntp_logout_all ();
-const char *nntp_format_str (char *, size_t, char, const char *, const char *,
+const char *nntp_format_str (char *, ssize_t, char, const char *, const char *,
const char *, const char *, unsigned long,
format_flag);
void nntp_sync_sidebar (NNTP_DATA*);
}
/* convert a simple search into a real request */
-void mutt_check_simple (char *s, size_t len, const char *simple)
+void mutt_check_simple (char *s, ssize_t len, const char *simple)
{
char tmp[LONG_STRING];
static pop_query_status pop_read_header (POP_DATA * pop_data, HEADER * h)
{
FILE *f;
- int index;
+ int idx;
pop_query_status ret;
long length;
char buf[LONG_STRING];
snprintf (buf, sizeof (buf), "string_list_t %d\r\n", h->refno);
ret = pop_query (pop_data, buf, sizeof (buf));
if (ret == PQ_OK) {
- sscanf (buf, "+OK %d %ld", &index, &length);
+ sscanf (buf, "+OK %d %ld", &idx, &length);
snprintf (buf, sizeof (buf), "TOP %d 0\r\n", h->refno);
ret = pop_fetch_data (pop_data, buf, NULL, fetch_message, f);
/* parse UIDL */
static int fetch_uidl (char *line, void *data)
{
- int i, index;
+ int i, idx;
CONTEXT *ctx = (CONTEXT *) data;
POP_DATA *pop_data = (POP_DATA *) ctx->data;
- sscanf (line, "%d %s", &index, line);
+ sscanf (line, "%d %s", &idx, line);
for (i = 0; i < ctx->msgcount; i++)
if (!m_strcmp(line, ctx->hdrs[i]->data))
break;
if (i == ctx->msgcount) {
- debug_print (1, ("new header %d %s\n", index, line));
+ debug_print (1, ("new header %d %s\n", idx, line));
if (i >= ctx->hdrmax)
mx_alloc_memory (ctx);
ctx->hdrs[i] = header_new();
ctx->hdrs[i]->data = m_strdup(line);
}
- else if (ctx->hdrs[i]->index != index - 1)
+ else if (ctx->hdrs[i]->index != idx - 1)
pop_data->clear_cache = 1;
- ctx->hdrs[i]->refno = index;
- ctx->hdrs[i]->index = index - 1;
+ ctx->hdrs[i]->refno = idx;
+ ctx->hdrs[i]->index = idx - 1;
return 0;
}
int ret;
char buf[LONG_STRING];
CONNECTION *conn;
- ACCOUNT acct;
+ ACCOUNT act;
POP_DATA *pop_data;
ciss_url_t url;
- if (pop_parse_path (ctx->path, &acct)) {
+ if (pop_parse_path (ctx->path, &act)) {
mutt_error (_("%s is an invalid POP path"), ctx->path);
mutt_sleep (2);
return -1;
}
- mutt_account_tourl (&acct, &url);
+ mutt_account_tourl (&act, &url);
url.path = NULL;
url_ciss_tostring (&url, buf, sizeof (buf), 0);
- conn = mutt_conn_find (NULL, &acct);
+ conn = mutt_conn_find (NULL, &act);
if (!conn)
return -1;
CONNECTION *conn;
CONTEXT ctx;
MESSAGE *msg = NULL;
- ACCOUNT acct;
+ ACCOUNT act;
POP_DATA *pop_data;
if (!PopHost) {
}
strcpy (p, PopHost); /* __STRCPY_CHECKED__ */
- ret = pop_parse_path (url, &acct);
+ ret = pop_parse_path (url, &act);
p_delete(&url);
if (ret) {
mutt_error (_("%s is an invalid POP path"), PopHost);
return;
}
- conn = mutt_conn_find (NULL, &acct);
+ conn = mutt_conn_find (NULL, &act);
if (!conn)
return;
} pop_auth_res_t;
typedef struct {
- unsigned int index;
+ int index;
char *path;
} POP_CACHE;
strlen (pop_data->conn->account.pass));
MD5Final (digest, &mdContext);
- for (i = 0; i < sizeof (digest); i++)
+ for (i = 0; i < ssizeof(digest); i++)
sprintf (hash + 2 * i, "%02x", digest[i]);
/* Send APOP command to server */
- snprintf (buf, sizeof (buf), "APOP %s %s\r\n", pop_data->conn->account.user,
- hash);
+ snprintf(buf, sizeof(buf), "APOP %s %s\r\n", pop_data->conn->account.user,
+ hash);
switch (pop_query (pop_data, buf, sizeof (buf))) {
case PQ_OK:
*/
pop_query_status pop_authenticate (POP_DATA * pop_data)
{
- ACCOUNT *acct = &pop_data->conn->account;
+ ACCOUNT *act = &pop_data->conn->account;
pop_auth_t *authenticator;
char *methods;
char *comma;
int attempts = 0;
int ret = POP_A_UNAVAIL;
- if (mutt_account_getuser (acct) || !acct->user[0] ||
- mutt_account_getpass (acct) || !acct->pass[0])
+ if (mutt_account_getuser (act) || !act->user[0] ||
+ mutt_account_getpass (act) || !act->pass[0])
return PFD_FUNCT_ERROR;
if (PopAuthenticators && *PopAuthenticators) {
#endif
/* given an POP mailbox name, return host, port, username and password */
-int pop_parse_path (const char *path, ACCOUNT * acct)
+int pop_parse_path (const char *path, ACCOUNT * act)
{
ciss_url_t url;
char *c;
int ret = -1;
/* Defaults */
- acct->flags = 0;
- acct->port = POP_PORT;
- acct->type = M_ACCT_TYPE_POP;
+ act->flags = 0;
+ act->port = POP_PORT;
+ act->type = M_ACCT_TYPE_POP;
c = m_strdup(path);
url_parse_ciss (&url, c);
if (url.scheme == U_POP || url.scheme == U_POPS) {
if (url.scheme == U_POPS) {
- acct->flags |= M_ACCT_SSL;
- acct->port = POP_SSL_PORT;
+ act->flags |= M_ACCT_SSL;
+ act->port = POP_SSL_PORT;
}
- if ((!url.path || !*url.path) && mutt_account_fromurl (acct, &url) == 0)
+ if ((!url.path || !*url.path) && mutt_account_fromurl (act, &url) == 0)
ret = 0;
}
m_strcpy(inbuf + lenbuf,sizeof(buf), p);
pos += chunk;
- if (chunk >= sizeof (buf)) {
+ if (chunk >= ssizeof(buf)) {
lenbuf += strlen (p);
- }
- else {
+ } else {
if (bar)
mutt_progress_bar (bar, pos);
if (ret == 0 && funct (inbuf, data) < 0)
/* find message with this UIDL and set refno */
static int check_uidl (char *line, void *data)
{
- int i;
- unsigned int index;
- CONTEXT *ctx = (CONTEXT *) data;
+ int i, idx;
+ CONTEXT *ctx = (CONTEXT *)data;
- sscanf (line, "%u %s", &index, line);
+ sscanf (line, "%u %s", &idx, line);
for (i = 0; i < ctx->msgcount; i++) {
if (!m_strcmp(ctx->hdrs[i]->data, line)) {
- ctx->hdrs[i]->refno = index;
+ ctx->hdrs[i]->refno = idx;
break;
}
}
* SENDREPLY recalled message is a reply
*/
int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc,
- size_t fcclen)
+ ssize_t fcclen)
{
HEADER *h;
int code = SENDPOSTPONED;
#define MoreArgs(p) (*p->dptr && *p->dptr != ';' && *p->dptr != '#')
#define mutt_make_string(A,B,C,D,E) _mutt_make_string(A,B,C,D,E,0)
-void _mutt_make_string (char *, size_t, const char *, CONTEXT *,
+void _mutt_make_string (char *, ssize_t, const char *, CONTEXT *,
HEADER *, format_flag);
#define mutt_new_enter_state() p_new(ENTER_STATE, 1)
-typedef const char *format_t (char *, size_t, char, const char *,
+typedef const char *format_t (char *, ssize_t, char, const char *,
const char *, const char *, const char *,
unsigned long, format_flag);
int query_quadoption (int, const char *);
int quadoption (int);
-int mutt_option_value (const char* val, char* dst, size_t dstlen);
+int mutt_option_value (const char* val, char* dst, ssize_t dstlen);
address_t *mutt_default_from (void);
address_t *mutt_remove_duplicates (address_t *);
time_t mutt_decrease_mtime (const char *, struct stat *);
void mutt_set_mtime (const char*, const char*);
time_t mutt_parse_date (const char *, HEADER *);
-int is_from (const char *, char *, size_t, time_t *);
+int is_from (const char *, char *, ssize_t, time_t *);
char *mutt_charset_hook (const char *);
char *mutt_iconv_hook (const char *);
-char *mutt_expand_path (char *, size_t);
-char *_mutt_expand_path (char *, size_t, int);
+char *mutt_expand_path (char *, ssize_t);
+char *_mutt_expand_path (char *, ssize_t, int);
char *mutt_find_hook (int, const char *);
char *mutt_gen_msgid (void);
-char *mutt_get_body_charset (char *, size_t, BODY *);
+char *mutt_get_body_charset (char *, ssize_t, BODY *);
const char *mutt_get_name (address_t *);
char *mutt_get_parameter (const char *, PARAMETER *);
char *mutt_crypt_hook (address_t *);
-char *mutt_make_date (char *, size_t);
+char *mutt_make_date (char *, ssize_t);
const char *mutt_make_version (int full);
void mutt_account_hook (const char *url);
void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv,
string_list_t *** pp, string_list_t *** qq);
-void mutt_adv_mktemp (const char*, char*, size_t);
+void mutt_adv_mktemp (const char*, char*, ssize_t);
int mutt_bounce_message (FILE * fp, HEADER *, address_t *);
-void mutt_canonical_charset (char *, size_t, const char *);
+void mutt_canonical_charset (char *, ssize_t, const char *);
void mutt_check_rescore (CONTEXT *);
void mutt_clear_error (void);
-void mutt_default_save (char *, size_t, HEADER *);
+void mutt_default_save (char *, ssize_t, HEADER *);
void mutt_display_address (ENVELOPE *);
void mutt_display_sanitize (char *);
void mutt_edit_content_type (HEADER *, BODY *, FILE *);
void mutt_edit_file (const char *, const char *);
-void mutt_edit_headers (const char *, const char *, HEADER *, char *, size_t);
+void mutt_edit_headers (const char *, const char *, HEADER *, char *, ssize_t);
void mutt_curses_error (const char *, ...);
void mutt_curses_message (const char *, ...);
void mutt_enter_command (void);
-void mutt_expand_file_fmt (char *, size_t, const char *, const char *);
-void mutt_expand_fmt (char *, size_t, const char *, const char *);
+void mutt_expand_file_fmt (char *, ssize_t, const char *, const char *);
+void mutt_expand_fmt (char *, ssize_t, const char *, const char *);
void mutt_expand_link (char *, const char *, const char *);
void mutt_fix_reply_recipients (ENVELOPE * env);
void mutt_folder_hook (char *);
void mutt_format_string (char *, ssize_t, int, int, int, char, const char *,
ssize_t, int);
-void mutt_format_s (char *, size_t, const char *, const char *);
-void mutt_format_s_tree (char *, size_t, const char *, const char *);
+void mutt_format_s (char *, ssize_t, const char *, const char *);
+void mutt_format_s_tree (char *, ssize_t, const char *, const char *);
void mutt_forward_intro (FILE * fp, HEADER * cur);
void mutt_forward_trailer (FILE * fp);
void mutt_free_body (BODY **);
void mutt_free_color (int fg, int bg);
-void mutt_generate_header (char *, size_t, HEADER *, int);
+void mutt_generate_header (char *, ssize_t, HEADER *, int);
void mutt_help (int);
void mutt_draw_tree (CONTEXT *);
void mutt_make_attribution (CONTEXT * ctx, HEADER * cur, FILE * out);
void mutt_make_forward_subject (ENVELOPE * env, CONTEXT * ctx, HEADER * cur);
-void mutt_make_help (char *, size_t, char *, int, int);
-char *mutt_compile_help(char *, size_t, int, struct mapping_t *);
+void mutt_make_help (char *, ssize_t, char *, int, int);
+char *mutt_compile_help(char *, ssize_t, int, struct mapping_t *);
void mutt_make_misc_reply_headers (ENVELOPE * env, CONTEXT * ctx,
HEADER * cur, ENVELOPE * curenv);
void mutt_make_post_indent (CONTEXT * ctx, HEADER * cur, FILE * out);
void mutt_prepare_envelope (ENVELOPE *, int);
void mutt_unprepare_envelope (ENVELOPE *);
void mutt_pretty_mailbox (char *);
-void mutt_pretty_size (char *, size_t, long);
+void mutt_pretty_size (char *, ssize_t, long);
void mutt_pipe_message (HEADER *);
void mutt_print_message (HEADER *);
void mutt_query_exit (void);
-void mutt_query_menu (char *, size_t);
-void mutt_safe_path (char *s, size_t l, address_t * a);
-void mutt_save_path (char *s, size_t l, address_t * a);
+void mutt_query_menu (char *, ssize_t);
+void mutt_safe_path (char *s, ssize_t l, address_t * a);
+void mutt_save_path (char *s, ssize_t l, address_t * a);
void mutt_score_message (CONTEXT *, HEADER *, int);
-void mutt_select_fcc (char *, size_t, HEADER *);
+void mutt_select_fcc (char *, ssize_t, HEADER *);
#define mutt_select_file(A,B,C) _mutt_select_file(A,B,C,NULL,NULL)
-void _mutt_select_file (char *, size_t, int, char ***, int *);
+void _mutt_select_file (char *, ssize_t, int, char ***, int *);
void mutt_message_hook (CONTEXT *, HEADER *, int);
void _mutt_set_flag (CONTEXT *, HEADER *, int, int, int);
int mutt_check_key (const char *);
int mutt_check_menu (const char *);
int mutt_check_month (const char *);
-int mutt_check_overwrite (const char *, const char *, char *, size_t, int *,
+int mutt_check_overwrite (const char *, const char *, char *, ssize_t, int *,
char **);
int mutt_check_traditional_pgp (HEADER *, int *);
-int mutt_command_complete (char *, size_t, int, int);
-int mutt_var_value_complete (char *, size_t, int);
-int mutt_complete (char *, size_t);
+int mutt_command_complete (char *, ssize_t, int, int);
+int mutt_var_value_complete (char *, ssize_t, int);
+int mutt_complete (char *, ssize_t);
int mutt_copy_body (FILE *, BODY **, BODY *);
int mutt_display_message (HEADER * h);
int mutt_resend_message (FILE *, CONTEXT *, HEADER *);
#define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
-int _mutt_enter_fname (const char *, char *, size_t, int *, int, int,
+int _mutt_enter_fname (const char *, char *, ssize_t, int *, int, int,
char ***, int *);
#define mutt_get_field(A,B,C,D) _mutt_get_field(A,B,C,D,0,NULL,NULL)
-int _mutt_get_field (const char *, char *, size_t, int, int, char ***, int *);
-int mutt_get_field_unbuffered (char *, char *, size_t, int);
+int _mutt_get_field (const char *, char *, ssize_t, int, int, char ***, int *);
+int mutt_get_field_unbuffered (char *, char *, ssize_t, int);
int mutt_get_hook_type (const char *);
-int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, size_t);
+int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, ssize_t);
int mutt_index_menu (void);
int mutt_invoke_mta (address_t *, address_t *, address_t *, address_t *, const char *,
int);
int mutt_parse_unscore (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_parse_unhook (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_pattern_func (int, char *);
-int mutt_query_complete (char *, size_t);
+int mutt_query_complete (char *, ssize_t);
int mutt_query_variables (string_list_t * queries);
int _mutt_save_message (HEADER *, CONTEXT *, int, int, int);
int mutt_save_message (HEADER *, int, int, int, int *);
int mutt_search_command (int, int);
int mutt_skipchars (const char *, const char *);
int mutt_strwidth (const char *);
-int mutt_compose_menu (HEADER *, char *, size_t, HEADER *);
+int mutt_compose_menu (HEADER *, char *, ssize_t, HEADER *);
int mutt_thread_set_flag (HEADER *, int, int, int);
int mutt_user_is_recipient (HEADER *);
void mutt_update_num_postponed (void);
int, int);
/* base64.c */
-void mutt_to_base64 (unsigned char *, const unsigned char *, size_t, size_t);
+void mutt_to_base64 (unsigned char *, const unsigned char *, ssize_t, ssize_t);
int mutt_from_base64 (char *, const char *);
/* utf8.c */
int mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags,
CONTEXT * ctx, HEADER * h);
pattern_t *mutt_pattern_comp ( /* const */ char *s, int flags, BUFFER * err);
-void mutt_check_simple (char *s, size_t len, const char *simple);
+void mutt_check_simple (char *s, ssize_t len, const char *simple);
void mutt_pattern_free (pattern_t ** pat);
-/* ----------------------------------------------------------------------------
- * Prototypes for broken systems
- */
-
-#ifdef HAVE_SRAND48
-#define LRAND lrand48
-#define SRAND srand48
-#define DRAND drand48
-#else
-#define LRAND rand
-#define SRAND srand
-#define DRAND (double)rand
-#endif /* HAVE_SRAND48 */
-
-/* HP-UX, ConvexOS and UNIXware don't have this macro */
-#ifndef S_ISLNK
-#define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK ? 1 : 0)
-#endif
-
-/* According to SCO support, this is how to detect SCO */
-#if defined (_M_UNIX) || defined (M_OS)
-#define SCO
-#endif
-
-#ifndef HAVE_SNPRINTF
-extern int snprintf (char *, size_t, const char *, ...);
-#endif
-
-#ifndef HAVE_VSNPRINTF
-extern int vsnprintf (char *, size_t, const char *, va_list);
-#endif
-
-#ifndef HAVE_STRERROR
-#ifndef STDC_HEADERS
-extern int sys_nerr;
-extern char *sys_errlist[];
-#endif
-
-#define strerror(x) ((x) > 0 && (x) < sys_nerr) ? sys_errlist[(x)] : 0
-#endif /* !HAVE_STRERROR */
-
-#ifndef HAVE_MEMMOVE
-#define memmove(d,s,n) bcopy((s),(d),(n))
-#endif
-
-#ifdef _AIX
-/* AIX doesn't define these in any headers (sigh) */
-int strcasecmp (const char *, const char *);
-int strncasecmp (const char *, const char *, size_t);
-
-int setegid (gid_t);
-#endif /* _AIX */
-
-#ifndef STDC_HEADERS
-extern FILE *fdopen ();
-extern int system ();
-extern int puts ();
-extern int fputs ();
-extern int fputc ();
-extern int fseeko ();
-extern char *strchr ();
-extern int getopt ();
-extern int fputs ();
-extern int fputc ();
-extern int fclose ();
-extern int fprintf ();
-extern int printf ();
-extern int fgetc ();
-extern int tolower ();
-extern int toupper ();
-extern int sscanf ();
-extern size_t fread ();
-extern size_t fwrite ();
-extern int system ();
-extern int rename ();
-extern time_t time ();
-extern struct tm *localtime ();
-extern char *asctime ();
-extern char *strpbrk ();
-extern int fflush ();
-extern long lrand48 ();
-extern void srand48 ();
-extern time_t mktime ();
-extern int vsprintf ();
-extern int ungetc ();
-extern char *mktemp ();
-extern int ftruncate ();
-extern void *memset ();
-extern int pclose ();
-extern int socket ();
-extern int connect ();
-extern size_t strftime ();
-extern int lstat ();
-extern void rewind ();
-extern int readlink ();
-
-/* IRIX barfs on empty var decls because the system include file uses elipsis
- in the declaration. So declare all the args to avoid compiler errors. This
- should be harmless on other systems. */
-int ioctl (int, int, ...);
-
-#endif
-
/* unsorted */
void ci_bounce_message (HEADER *, int *);
int ci_send_message (int, HEADER *, char *, CONTEXT *, HEADER *);
static int FirstColumn;
static int SecondColumn;
-static void query_menu (char *buf, size_t buflen, QUERY * results,
+static void query_menu (char *buf, ssize_t buflen, QUERY * results,
int retbuf);
static address_t *result_to_addr (QUERY * r)
QUERY *cur = NULL;
char cmd[_POSIX_PATH_MAX];
char *buf = NULL;
- size_t buflen;
+ ssize_t buflen;
int dummy = 0;
char msg[STRING];
char *p;
return cur->tagged - ot;
}
-int mutt_query_complete (char *buf, size_t buflen)
+int mutt_query_complete (char *buf, ssize_t buflen)
{
QUERY *results = NULL;
address_t *tmpa;
return (0);
}
-void mutt_query_menu (char *buf, size_t buflen)
+void mutt_query_menu (char *buf, ssize_t buflen)
{
if (!QueryCmd) {
mutt_error _("Query command not defined.");
}
}
-static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
+static void query_menu (char *buf, ssize_t buflen, QUERY * results, int retbuf)
{
MUTTMENU *menu;
HEADER *msg = NULL;
/* if we need to return the selected entries */
if (retbuf && (done == 2)) {
int tagged = 0;
- size_t curpos = 0;
+ ssize_t curpos = 0;
p_clear(buf, buflen);
* %u = unlink
*/
const char *mutt_attach_fmt (char *dest,
- size_t destlen,
+ ssize_t destlen,
char op,
const char *src,
const char *prefix,
char charset[SHORT_STRING];
ATTACHPTR *aptr = (ATTACHPTR *) data;
int optional = (flags & M_FORMAT_OPTIONAL);
- size_t l;
+ ssize_t l;
switch (op) {
case 'C':
int, int);
const char *mutt_attach_fmt (char *dest,
- size_t destlen,
+ ssize_t destlen,
char op,
const char *src,
const char *prefix,
if (option (OPTMAILCAPSANITIZE))
mutt_sanitize_filename (type, 0);
- while (command[x] && x < clen && y < sizeof (buf)) {
+ while (command[x] && x < clen && y < ssizeof (buf)) {
if (command[x] == '\\') {
x++;
buf[y++] = command[x++];
int z = 0;
x++;
- while (command[x] && command[x] != '}' && z < sizeof (param))
+ while (command[x] && command[x] != '}' && z < ssizeof (param))
param[z++] = command[x++];
param[z] = '\0';
{
FILE *fp;
char *buf = NULL;
- size_t buflen;
+ ssize_t buflen;
char *ch;
char *field;
int found = FALSE;
btlen = ch - type;
if ((fp = fopen (filename, "r")) != NULL) {
- while (!found && (buf = mutt_read_line (buf, &buflen, fp, &line)) != NULL) {
+ while (!found && (buf = mutt_read_line(buf, &buflen, fp, &line)) != NULL) {
/* ignore comments */
if (*buf == '#')
continue;
* if this is the right entry.
*/
char *test_command = NULL;
- size_t len;
+ ssize_t len;
if (get_field_text (field + 4, &test_command, type, filename, line)
&& test_command) {
while (!found && *curr) {
x = 0;
- while (*curr && *curr != ':' && x < sizeof (path) - 1) {
+ while (*curr && *curr != ':' && x < ssizeof (path) - 1) {
path[x++] = *curr;
curr++;
}
* Returns 1 if newfile specified
*/
-static void strnfcpy (char *d, char *s, size_t siz, size_t len)
-{
- if (len > siz)
- len = siz - 1;
- m_strcpy(d, len, s);
-}
-
int rfc1524_expand_filename (char *nametemplate,
- char *oldfile, char *newfile, size_t nflen)
+ char *oldfile, char *newfile, ssize_t nflen)
{
int i, j, k, ps, r;
char *s;
if (lmatch)
*left = 0;
else
- strnfcpy (left, nametemplate, sizeof (left), i);
+ m_strncpy(left, sizeof(left), nametemplate, i);
if (rmatch)
*right = 0;
rfc1524_entry *rfc1524_new_entry (void);
void rfc1524_free_entry (rfc1524_entry **);
int rfc1524_expand_command (BODY *, char *, char *, char *, int);
-int rfc1524_expand_filename (char *, char *, char *, size_t);
+int rfc1524_expand_filename (char *, char *, char *, ssize_t);
int rfc1524_mailcap_lookup (BODY *, char *, rfc1524_entry *, int);
int mutt_rename_file (char *, char *);
int _mutt_rename_file (char *, char *, int);
rs[BOUNDARYLEN] = 0;
for (i = 0; i < BOUNDARYLEN; i++)
- *p++ = __m_b64chars[LRAND() % sizeof(__m_b64chars)];
+ *p++ = __m_b64chars[lrand48() % sizeof(__m_b64chars)];
*p = 0;
mutt_set_parameter ("boundary", rs, parm);
static void update_content_info (CONTENT * info, CONTENT_STATE * s, char *d,
- size_t dlen)
+ ssize_t dlen)
{
int from = s->from;
int whitespace = s->whitespace;
* long as the input for any pair of charsets we might be interested
* in.
*/
-static size_t convert_file_to (FILE * file, const char *fromcode,
+static ssize_t convert_file_to (FILE * file, const char *fromcode,
int ncodes, const char **tocodes,
int *tocode, CONTENT * info)
{
char bufi[256], bufu[512], bufo[4 * sizeof (bufi)];
const char *ib, *ub;
char *ob;
- size_t ibl, obl, ubl, ubl1, n, ret;
+ ssize_t ibl, obl, ubl, ubl1, n, ret;
int i;
CONTENT *infos;
CONTENT_STATE *states;
- size_t *score;
+ ssize_t *score;
cd1 = mutt_iconv_open ("UTF-8", fromcode, 0);
if (cd1 == (iconv_t) (-1))
return -1;
cd = p_new(iconv_t, ncodes);
- score = p_new(size_t, ncodes);
+ score = p_new(ssize_t, ncodes);
states = p_new(CONTENT_STATE, ncodes);
infos = p_new(CONTENT, ncodes);
cd[i] = mutt_iconv_open (tocodes[i], "UTF-8", 0);
else
/* Special case for conversion to UTF-8 */
- cd[i] = (iconv_t) (-1), score[i] = (size_t) (-1);
+ cd[i] = (iconv_t) (-1), score[i] = -1;
rewind (file);
ibl = 0;
ib = bufi;
ob = bufu, obl = sizeof (bufu);
n = my_iconv(cd1, ibl ? &ib : 0, &ibl, &ob, &obl);
- assert (n == (size_t) (-1) || !n || ICONV_NONTRANS);
- if (n == (size_t) (-1) &&
+ assert (n == -1 || !n || ICONV_NONTRANS);
+ if (n == -1 &&
((errno != EINVAL && errno != E2BIG) || ib == bufi)) {
assert (errno == EILSEQ ||
- (errno == EINVAL && ib == bufi && ibl < sizeof (bufi)));
- ret = (size_t) (-1);
+ (errno == EINVAL && ib == bufi && ibl < ssizeof (bufi)));
+ ret = -1;
break;
}
ubl1 = ob - bufu;
/* Convert from UTF-8 */
for (i = 0; i < ncodes; i++)
- if (cd[i] != (iconv_t) (-1) && score[i] != (size_t) (-1)) {
+ if (cd[i] != (iconv_t) (-1) && score[i] != -1) {
ub = bufu, ubl = ubl1;
ob = bufo, obl = sizeof (bufo);
n = my_iconv(cd[i], (ibl || ubl) ? &ub : 0, &ubl, &ob, &obl);
- if (n == (size_t) (-1)) {
+ if (n == -1) {
assert (errno == E2BIG ||
(BUGGY_ICONV && (errno == EILSEQ || errno == ENOENT)));
- score[i] = (size_t) (-1);
+ score[i] = -1;
}
else {
score[i] += n;
update_content_info (&infos[i], &states[i], bufo, ob - bufo);
}
}
- else if (cd[i] == (iconv_t) (-1) && score[i] == (size_t) (-1))
+ else if (cd[i] == (iconv_t) (-1) && score[i] == -1)
/* Special case for conversion to UTF-8 */
update_content_info (&infos[i], &states[i], bufu, ubl1);
if (!ret) {
/* Find best score */
- ret = (size_t) (-1);
+ ret = -1;
for (i = 0; i < ncodes; i++) {
- if (cd[i] == (iconv_t) (-1) && score[i] == (size_t) (-1)) {
+ if (cd[i] == (iconv_t) (-1) && score[i] == -1) {
/* Special case for conversion to UTF-8 */
*tocode = i;
ret = 0;
break;
}
- else if (cd[i] == (iconv_t) (-1) || score[i] == (size_t) (-1))
+ else if (cd[i] == (iconv_t) (-1) || score[i] == -1)
continue;
- else if (ret == (size_t) (-1) || score[i] < ret) {
+ else if (ret == -1 || score[i] < ret) {
*tocode = i;
ret = score[i];
if (!ret)
break;
}
}
- if (ret != (size_t) (-1)) {
+ if (ret != -1) {
memcpy (info, &infos[*tocode], sizeof (CONTENT));
update_content_info (info, &states[*tocode], 0, 0); /* EOF */
}
* However, if fromcode is zero then fromcodes is assumed to be the
* name of a single charset even if it contains a colon.
*/
-static size_t convert_file_from_to (FILE * file,
+static ssize_t convert_file_from_to (FILE * file,
const char *fromcodes,
const char *tocodes, char **fromcode,
char **tocode, CONTENT * info)
char *fcode;
char **tcode;
const char *c, *c1;
- size_t ret;
+ ssize_t ret;
int ncodes, i, cn;
/* Count the tocodes */
tcode[i] = m_substrdup(c, c1);
}
- ret = (size_t) (-1);
+ ret = -1;
if (fromcode) {
/* Try each fromcode in turn */
for (c = fromcodes; c; c = c1 ? c1 + 1 : 0) {
ret = convert_file_to (file, fcode, ncodes, (const char **) tcode,
&cn, info);
- if (ret != (size_t) (-1)) {
+ if (ret != -1) {
*fromcode = fcode;
*tocode = tcode[cn];
tcode[cn] = 0;
/* There is only one fromcode */
ret = convert_file_to (file, fromcodes, ncodes, (const char **) tcode,
&cn, info);
- if (ret != (size_t) (-1)) {
+ if (ret != -1) {
*tocode = tcode[cn];
tcode[cn] = 0;
}
char *tocode = NULL;
char buffer[100];
char chsbuf[STRING];
- size_t r;
+ ssize_t r;
struct stat sb;
FileCharset : Charset) : Charset;
if (Charset && (chs || SendCharset) &&
convert_file_from_to (fp, fchs, chs ? chs : SendCharset,
- &fromcode, &tocode, info) != (size_t) (-1)) {
+ &fromcode, &tocode, info) != -1) {
if (!chs) {
mutt_canonical_charset (chsbuf, sizeof (chsbuf), tocode);
mutt_set_parameter ("charset", chsbuf, &b->parameter);
/* Get a body's character set */
-char *mutt_get_body_charset (char *d, size_t dlen, BODY * b)
+char *mutt_get_body_charset (char *d, ssize_t dlen, BODY * b)
{
char *p = NULL;
return b;
}
-char *mutt_make_date (char *s, size_t len)
+char *mutt_make_date (char *s, ssize_t len)
{
time_t t = time (NULL);
struct tm *l = localtime (&t);
}
static const char **
-add_args(const char **args, size_t *argslen, size_t *argsmax, address_t * addr)
+add_args(const char **args, ssize_t *argslen, ssize_t *argsmax, address_t * addr)
{
for (; addr; addr = addr->next) {
/* weed out group mailboxes, since those are for display only */
}
static const char **
-add_option(const char **args, size_t *argslen, size_t *argsmax, const char *s)
+add_option(const char **args, ssize_t *argslen, ssize_t *argsmax, const char *s)
{
if (*argslen == *argsmax) {
p_realloc(&args, *argsmax += 5);
{ /* message contains 8bit chars */
char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
const char **args = NULL;
- size_t argslen = 0, argsmax = 0;
+ ssize_t argslen = 0, argsmax = 0;
int i;
#ifdef USE_NNTP
string. */
char *mutt_append_string (char *a, const char *b)
{
- size_t la = m_strlen(a);
+ ssize_t la = m_strlen(a);
p_realloc(&a, la + m_strlen(b) + 1);
strcpy (a + la, b); /* __STRCPY_CHECKED__ */
char *mutt_quote_string (const char *s)
{
char *r, *pr;
- size_t rlen;
+ ssize_t rlen;
rlen = m_strlen(s) + 3;
pr = r = p_new(char, rlen);
*pr++ = '"';
while (*s) {
if (INVALID_CHAR (*s)) {
- size_t o = pr - r;
+ ssize_t o = pr - r;
p_realloc(&r, ++rlen);
pr = r + o;