mkchangelog.sh cvslog2changelog.pl mutt_idna.h \
regex.c mutt_libesmtp.h crypt-gpgme.h
-muttng_dotlock_SOURCES = mutt_dotlock.c
+muttng_dotlock_SOURCES = dotlock.c
muttng_dotlock_LDADD = @LIBOBJS@
muttng_dotlock_DEPENDENCIES = @LIBOBJS@
pgpewrapng_LDADD =
pgpewrapng_DEPENDENCIES =
-mutt_dotlock.c: dotlock.c
- cp $(srcdir)/dotlock.c mutt_dotlock.c
-
-CLEANFILES = mutt_dotlock.c stamp-doc-rc makedoc \
+CLEANFILES = stamp-doc-rc makedoc \
keymap_alldefs.h keymap_defs.h version.h
ACLOCAL_AMFLAGS = -I m4
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "account.h"
#include "url.h"
-#include "lib/str.h"
/* mutt_account_match: compare account info (host/port/user/login) */
int mutt_account_match (const ACCOUNT * a1, const ACCOUNT * a2)
#include <ctype.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
-#include "lib/str.h"
#include "lib/rx.h"
#include "lib/debug.h"
if (!i) {
u = p_new(LIST, 1);
- u->data = str_dup (a->mailbox);
+ u->data = m_strdup(a->mailbox);
u->next = *expn;
*expn = u;
w = rfc822_cpy_adr (t);
new = p_new(ALIAS, 1);
new->self = new;
- new->name = str_dup (buf);
+ new->name = m_strdup(buf);
mutt_addrlist_to_local (adr);
mutt_free_alias (&new);
return;
}
- new->addr->personal = str_dup (buf);
+ new->addr->personal = m_strdup(buf);
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), new->addr, 1);
if (a->name && strstr (a->name, s) == a->name) {
if (!bestname[0]) /* init */
strfcpy (bestname, a->name,
- min (str_len (a->name) + 1, sizeof (bestname)));
+ min (m_strlen(a->name) + 1, sizeof (bestname)));
else {
for (i = 0; a->name[i] && a->name[i] == bestname[i]; i++);
bestname[i] = 0;
if (bestname[0] != 0) {
if (str_cmp (bestname, s) != 0) {
/* we are adding something to the completion */
- strfcpy (s, bestname, str_len (bestname) + 1);
+ strfcpy (s, bestname, m_strlen(bestname) + 1);
return 1;
}
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mx.h"
#include "mutt_crypt.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <ctype.h>
}
}
else {
- lng = str_len (p);
+ lng = m_strlen(p);
if (buf[lng] == '/' && str_ncasecmp (buf, p, lng) == 0)
return (1);
}
int i;
for (; t; t = t->next) {
- i = str_len (t->data) - 1;
+ i = m_strlen(t->data) - 1;
if ((i > 0 && t->data[i - 1] == '/' && t->data[i] == '*' &&
ascii_strncasecmp (type, t->data, i) == 0) ||
ascii_strcasecmp (type, t->data) == 0) {
}
for (; t; t = t->next) {
- i = str_len (t->data) - 1;
+ i = m_strlen(t->data) - 1;
if ((i > 0 && t->data[i - 1] == '/' && t->data[i] == '*' &&
ascii_strncasecmp (type, t->data, i) == 0) ||
ascii_strcasecmp (type, t->data) == 0)
strfcpy (command, entry->command, sizeof (command));
if (fp) {
- fname = str_dup (a->filename);
+ fname = m_strdup(a->filename);
mutt_sanitize_filename (fname, 1);
}
else
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#endif
#include "sidebar.h"
-#include "lib/str.h"
#include "lib/list.h"
#include <stdlib.h>
}
(state->entry)[state->entrylen].new = new;
- (state->entry)[state->entrylen].name = str_dup (name);
- (state->entry)[state->entrylen].desc = str_dup (name);
+ (state->entry)[state->entrylen].name = m_strdup(name);
+ (state->entry)[state->entrylen].desc = m_strdup(name);
#ifdef USE_IMAP
(state->entry)[state->entrylen].imap = 0;
#endif
continue;
nntp_sync_sidebar (data);
if (prefix && *prefix && strncmp (prefix, data->group,
- str_len (prefix)) != 0)
+ m_strlen(prefix)) != 0)
continue;
if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not))
continue;
continue; /* we don't need . */
if (prefix && *prefix
- && str_ncmp (prefix, de->d_name, str_len (prefix)) != 0)
+ && str_ncmp (prefix, de->d_name, m_strlen(prefix)) != 0)
continue;
if (!((regexec (Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not))
continue;
}
else {
#endif
- for (i = str_len (f) - 1; i > 0 && f[i] != '/'; i--);
+ for (i = m_strlen(f) - 1; i > 0 && f[i] != '/'; i--);
if (i > 0) {
if (f[0] == '/') {
if (i > sizeof (LastDir) - 1)
strfcpy (OldLastDir, LastDir, sizeof (OldLastDir));
if (str_cmp (state.entry[menu->current].name, "..") == 0) {
- if (str_cmp ("..", LastDir + str_len (LastDir) - 2) == 0)
+ if (str_cmp ("..", LastDir + m_strlen(LastDir) - 2) == 0)
strcat (LastDir, "/.."); /* __STRCAT_CHECKED__ */
else {
char *p = strrchr (LastDir + 1, '/');
strfcpy (LastDir, state.entry[menu->current].name,
sizeof (LastDir));
/* tack on delimiter here */
- n = str_len (LastDir) + 1;
+ n = m_strlen(LastDir) + 1;
/* special case "" needs no delimiter */
url_parse_ciss (&url, state.entry[menu->current].name);
if (ff.tagged) {
mutt_concat_path (full, LastDir, ff.name, sizeof (full));
mutt_expand_path (full, sizeof (full));
- tfiles[j++] = str_dup (full);
+ tfiles[j++] = m_strdup(full);
}
}
*files = tfiles;
*numfiles = 1;
tfiles = p_new(char *, *numfiles);
mutt_expand_path (f, flen);
- tfiles[0] = str_dup (f);
+ tfiles[0] = m_strdup(f);
*files = tfiles;
}
}
#endif
{
/* add '/' at the end of the directory name if not already there */
- int len = str_len (LastDir);
+ int len = m_strlen(LastDir);
if (len && LastDir[len - 1] != '/' && sizeof (buf) > len)
buf[len] = '/';
mutt_FormatString (buffer, sizeof (buffer), NONULL(GroupFormat),
newsgroup_format_str, (unsigned long) &folder,
M_FORMAT_ARROWCURSOR);
- f->desc = str_dup (buffer); */
+ f->desc = m_strdup(buffer); */
if (menu->current + 1 < menu->max)
menu->current++;
menu->redraw = REDRAW_MOTION_RESYNCH;
mutt_FormatString (buffer, sizeof (buffer), NONULL(GroupFormat),
newsgroup_format_str, (unsigned long) &folder,
M_FORMAT_ARROWCURSOR);
- f->desc = str_dup (buffer);
+ f->desc = m_strdup(buffer);
} */
}
if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE) {
#include <ctype.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "buffer.h"
-#include "lib/str.h"
#include "lib/debug.h"
/*
return NULL;
b = mutt_buffer_init (b);
- b->data = str_dup (seed);
- b->dsize = str_len (seed);
+ b->data = m_strdup(seed);
+ b->dsize = m_strlen(seed);
b->dptr = (char *) b->data + b->dsize;
return b;
}
void mutt_buffer_addstr (BUFFER * buf, const char *s)
{
- mutt_buffer_add (buf, s, str_len (s));
+ mutt_buffer_add (buf, s, m_strlen(s));
}
void mutt_buffer_addch (BUFFER * buf, char c)
p_delete(&expn.data);
}
else if (expn.data) {
- expnlen = str_len (expn.data);
- tok->dsize = expnlen + str_len (tok->dptr) + 1;
+ expnlen = m_strlen(expn.data);
+ tok->dsize = expnlen + m_strlen(tok->dptr) + 1;
ptr = xmalloc(tok->dsize);
memcpy (ptr, expn.data, expnlen);
strcpy (ptr + expnlen, tok->dptr); /* __STRCPY_CHECKED__ */
* reads will be on block boundaries, which might increase efficiency. */
while ((pos -= bytes_read) >= 0) {
/* we save in the buffer at the end the first 7 chars from the last read */
- strncpy (buffer + BUFSIZ, buffer, 5 + 2); /* 2 == 2 * str_len(CRLF) */
+ strncpy (buffer + BUFSIZ, buffer, 5 + 2); /* 2 == 2 * m_strlen(CRLF) */
fseeko (f, pos, SEEK_SET);
bytes_read = fread (buffer, sizeof (char), bytes_read, f);
if (bytes_read == -1)
return -1;
for (i = bytes_read; --i >= 0;)
- if (!str_ncmp (buffer + i, "\n\nFrom ", str_len ("\n\nFrom "))) { /* found it - go to the beginning of the From */
+ if (!str_ncmp (buffer + i, "\n\nFrom ", m_strlen("\n\nFrom "))) { /* found it - go to the beginning of the From */
fseeko (f, pos + i + 2, SEEK_SET);
return 0;
}
if (i < 0) {
tmp = p_new(BUFFY, 1);
- tmp->path = str_dup (buf);
+ tmp->path = m_strdup(buf);
tmp->magic = 0;
list_push_back (&Incoming, tmp);
i = Incoming->length-1;
pos = 0;
first = 1;
buffylist[0] = 0;
- pos += str_len (strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
+ pos += m_strlen(strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
if (Incoming) {
for (i = 0; i < Incoming->length; i++) {
tmp = (BUFFY*) Incoming->data[i];
strfcpy (path, tmp->path, sizeof (path));
mutt_pretty_mailbox (path);
- if (!first && pos + str_len (path) >= COLS - 7)
+ if (!first && pos + m_strlen(path) >= COLS - 7)
break;
if (!first)
- pos += str_len (strncat (buffylist + pos, ", ", sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
+ pos += m_strlen(strncat (buffylist + pos, ", ", sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
/* Prepend an asterisk to mailboxes not already notified */
if (!tmp->notified) {
- /* pos += str_len (strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos)); __STRNCAT_CHECKED__ */
+ /* pos += m_strlen(strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos)); __STRNCAT_CHECKED__ */
tmp->notified = 1;
BuffyNotify--;
}
- pos += str_len (strncat (buffylist + pos, path, sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
+ pos += m_strlen(strncat (buffylist + pos, path, sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
first = 0;
}
}
#include <errno.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "charset.h"
#include "ascii.h"
-#include "lib/str.h"
#ifndef EILSEQ
# define EILSEQ EINVAL
mutt_canonical_charset (buff2, sizeof (buff2), buff);
/* finally, set $charset */
- if (!(Charset = str_dup (buff2)))
- Charset = str_dup ("iso-8859-1");
+ if (!(Charset = m_strdup(buff2)))
+ Charset = m_strdup("iso-8859-1");
}
#else
void mutt_set_langinfo_charset (void)
{
- Charset = str_dup ("iso-8859-1");
+ Charset = m_strdup("iso-8859-1");
}
#endif
for (t = inrepls; *t; t++) {
const char *ib1 = *t;
- size_t ibl1 = str_len (*t);
+ size_t ibl1 = m_strlen(*t);
char *ob1 = ob;
size_t obl1 = obl;
outrepl = "?";
my_iconv(cd, 0, 0, &ob, &obl);
if (obl) {
- int n = str_len (outrepl);
+ int n = m_strlen(outrepl);
if (n > obl) {
outrepl = "?";
else
outrepl = "?";
- len = str_len (s);
+ len = m_strlen(s);
ib = s, ibl = len + 1;
obl = MB_LEN_MAX * ibl;
ob = buf = xmalloc(obl + 1);
const char *c, *c1;
c = charset;
- if (!str_len (c))
+ if (!m_strlen(c))
return "us-ascii";
if (!(c1 = strchr (c, ':')))
return ((char*) charset);
char *s = NULL;
char *fromcode;
size_t m, n;
- size_t ulen = str_len (*ps);
+ size_t ulen = m_strlen(*ps);
size_t slen;
if (!u || !*u)
return 0;
c1 = strchr (c, ':');
- n = c1 ? c1 - c : str_len (c);
+ n = c1 ? c1 - c : m_strlen(c);
if (!n)
continue;
fromcode = p_dupstr(c, n);
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_curses.h"
#include "mapping.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <string.h>
return (-1);
}
tmp->next = *top;
- tmp->pattern = str_dup (s);
+ tmp->pattern = m_strdup(s);
#ifdef HAVE_COLOR
if (fg != -1 && bg != -1) {
tmp->fg = fg;
#endif
#include <lib-lib/mem.h>
+
#include <lib-lib/macros.h>
#include "mutt.h"
#include "buffy.h"
#endif
-#include "lib/str.h"
#include "lib/debug.h"
#include <errno.h>
size_t l;
for (p = b->parameter; p; p = p->next) {
- l = str_len (buf);
+ l = m_strlen(buf);
rfc822_cat (tmp, sizeof (tmp), p->value, MimeSpecials);
snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp);
#include "nntp.h"
#endif
-#include "lib/str.h"
+#include <lib-lib/str.h>
#include "lib/debug.h"
#include <dirent.h>
* special case to handle when there is no filepart yet.
* find the first subscribed newsgroup
*/
- if ((len = str_len (filepart)) == 0) {
+ if ((len = m_strlen(filepart)) == 0) {
for (; l; l = l->next) {
NNTP_DATA *data = (NNTP_DATA *) l->data;
* special case to handle when there is no filepart yet. find the first
* file/directory which is not ``.'' or ``..''
*/
- if ((len = str_len (filepart)) == 0) {
+ if ((len = m_strlen(filepart)) == 0) {
while ((de = readdir (dirp)) != NULL) {
if (str_cmp (".", de->d_name) != 0
&& str_cmp ("..", de->d_name) != 0) {
/* check to see if it is a directory */
if (dirpart[0]) {
strfcpy (buf, exp_dirpart, sizeof (buf));
- strfcpy (buf + str_len (buf), "/", sizeof (buf) - str_len (buf));
+ strfcpy (buf + m_strlen(buf), "/", sizeof (buf) - m_strlen(buf));
}
else
buf[0] = 0;
- strfcpy (buf + str_len (buf), filepart, sizeof (buf) - str_len (buf));
+ strfcpy (buf + m_strlen(buf), filepart, sizeof (buf) - m_strlen(buf));
if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR))
- strfcpy (filepart + str_len (filepart), "/",
- sizeof (filepart) - str_len (filepart));
+ strfcpy (filepart + m_strlen(filepart), "/",
+ sizeof (filepart) - m_strlen(filepart));
init = 1;
}
}
strfcpy (s, dirpart, slen);
if (str_cmp ("/", dirpart) != 0 && dirpart[0] != '='
&& dirpart[0] != '+')
- strfcpy (s + str_len (s), "/", slen - str_len (s));
- strfcpy (s + str_len (s), filepart, slen - str_len (s));
+ strfcpy (s + m_strlen(s), "/", slen - m_strlen(s));
+ strfcpy (s + m_strlen(s), filepart, slen - m_strlen(s));
}
else
strfcpy (s, filepart, slen);
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "nntp.h"
#endif
-#include "lib/str.h"
#include <errno.h>
#include <string.h>
if (t && t[0] == '0' && t[1] == '\0')
t = "<random>";
- if (c + str_len (t) + 2 >= COLS - SW)
+ if (c + m_strlen(t) + 2 >= COLS - SW)
break;
addstr (NONULL (t));
if (chain->next)
addstr (", ");
- c += str_len (t) + 2;
+ c += m_strlen(t) + 2;
}
}
#endif /* MIXMASTER */
&& buf[0]) {
p_delete(&msg->env->newsgroups);
str_skip_trailws (buf);
- msg->env->newsgroups = str_dup (str_skip_initws (buf));
+ msg->env->newsgroups = m_strdup(str_skip_initws (buf));
move (HDR_TO, HDR_XOFFSET);
clrtoeol ();
if (msg->env->newsgroups)
&& buf[0]) {
p_delete(&msg->env->followup_to);
str_skip_trailws (buf);
- msg->env->followup_to = str_dup (str_skip_initws (buf));
+ msg->env->followup_to = m_strdup(str_skip_initws (buf));
move (HDR_CC, HDR_XOFFSET);
clrtoeol ();
if (msg->env->followup_to)
if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0
&& buf[0]) {
p_delete(&msg->env->x_comment_to);
- msg->env->x_comment_to = str_dup (buf);
+ msg->env->x_comment_to = m_strdup(buf);
move (HDR_BCC, HDR_XOFFSET);
clrtoeol ();
if (msg->env->x_comment_to)
*/
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mbox.h"
#include "mutt_curses.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <errno.h>
/* Uncompress to /tmp */
mutt_mktemp (tmppath);
- ctx->path = p_dupstr(tmppath, str_len(tmppath));
+ ctx->path = p_dupstr(tmppath, m_strlen(tmppath));
}
static int get_size (const char *path)
mutt_FormatString (expanded, sizeof (expanded), cmd,
compresshook_format_str, (unsigned long) ctx, 0);
- return str_dup (expanded);
+ return m_strdup(expanded);
}
int mutt_check_mailbox_compressed (CONTEXT * ctx)
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "mutt.h"
#include "ascii.h"
#include "mutt_crypt.h"
#include "mutt_idna.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <string.h>
if (!headers[x])
headers[x] = this_one;
else {
- p_realloc(&headers[x], str_len(headers[x]) + str_len(this_one) + 1);
+ p_realloc(&headers[x], m_strlen(headers[x]) + m_strlen(this_one) + 1);
strcat(headers[x], this_one); /* __STRCAT_CHECKED__ */
p_delete(&this_one);
}
/* Find x -- the array entry where this header is to be saved */
if (flags & CH_REORDER) {
for (t = HeaderOrderList, x = 0; (t); t = t->next, x++) {
- if (!ascii_strncasecmp (buf, t->data, str_len (t->data))) {
+ if (!ascii_strncasecmp (buf, t->data, m_strlen(t->data))) {
debug_print (2, ("Reorder: %s matches %s\n", t->data, buf));
break;
}
if (!ignore) {
debug_print (2, ("Reorder: x = %d; hdr_count = %d\n", x, hdr_count));
if (!this_one)
- this_one = str_dup (buf);
+ this_one = m_strdup(buf);
/* we do want to see all lines if this header doesn't feature
* abbreviations (curline is 0), $max_display_recips is 0 and
* while the number hasn't reached $max_display_recips yet */
else if (curline == 0 || MaxDispRecips == 0 || ++curline <= MaxDispRecips) {
- p_realloc(&this_one, str_len(this_one) + str_len(buf) + 1);
+ p_realloc(&this_one, m_strlen(this_one) + m_strlen(buf) + 1);
strcat (this_one, buf); /* __STRCAT_CHECKED__ */
/* only for the first line which doesn't exeeds
* $max_display_recips: abbreviate it */
} else if (curline == MaxDispRecips+1) {
- p_realloc(&this_one, str_len(this_one) + 5);
+ p_realloc(&this_one, m_strlen(this_one) + 5);
strcat (this_one, " ...");
}
}
if (!headers[x])
headers[x] = this_one;
else {
- p_realloc(&headers[x], str_len(headers[x]) + str_len(this_one) + 1);
+ p_realloc(&headers[x], m_strlen(headers[x]) + m_strlen(this_one) + 1);
strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */
p_delete(&this_one);
}
char date[SHORT_STRING];
mutt_make_date (date, sizeof (date));
- date[5] = date[str_len (date) - 1] = '\"';
+ date[5] = date[m_strlen(date) - 1] = '\"';
/* Count the number of lines and bytes to be deleted */
fseeko (fpin, body->offset, SEEK_SET);
new_lines = hdr->lines -
- count_delete_lines (fpin, body, &new_length, str_len (date));
+ count_delete_lines (fpin, body, &new_length, m_strlen(date));
/* Copy the headers */
if (mutt_copy_header (fpin, hdr, fpout,
int l, linelen, buflen, count;
- linelen = str_len (*h);
+ linelen = m_strlen(*h);
buflen = linelen + 3;
rfc822_write_address (buf, sizeof (buf), a, 0);
a->next = tmp;
- l = str_len (buf);
+ l = m_strlen(buf);
if (count && linelen + l > 74) {
strcpy (cbuf, "\n\t"); /* __STRCPY_CHECKED__ */
linelen = l + 8;
strcpy (c2buf, ","); /* __STRCPY_CHECKED__ */
}
- buflen += l + str_len (cbuf) + str_len (c2buf);
+ buflen += l + m_strlen(cbuf) + m_strlen(c2buf);
p_realloc(h, buflen);
strcat (*h, cbuf); /* __STRCAT_CHECKED__ */
strcat (*h, buf); /* __STRCAT_CHECKED__ */
#ifdef CRYPT_BACKEND_GPGME
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "recvattach.h"
#include "sort.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <sys/wait.h>
if (k->kobj && k->kobj->subkeys) {
s = k->kobj->subkeys->keyid;
- if ((!option (OPTPGPLONGIDS)) && (str_len (s) == 16))
+ if ((!option (OPTPGPLONGIDS)) && (m_strlen(s) == 16))
/* Return only the short keyID. */
s += 8;
}
}
if (ret_fp)
*ret_fp = fp;
- return str_dup (tempfile);
+ return m_strdup(tempfile);
}
t = mutt_new_body ();
t->type = TYPEMULTIPART;
- t->subtype = str_dup ("signed");
+ t->subtype = m_strdup("signed");
t->encoding = ENC7BIT;
t->use_disp = 0;
t->disposition = DISPINLINE;
t = t->parts->next;
t->type = TYPEAPPLICATION;
if (use_smime) {
- t->subtype = str_dup ("pkcs7-signature");
+ t->subtype = m_strdup("pkcs7-signature");
mutt_set_parameter ("name", "smime.p7s", &t->parameter);
t->encoding = ENCBASE64;
t->use_disp = 1;
t->disposition = DISPATTACH;
- t->d_filename = str_dup ("smime.p7s");
+ t->d_filename = m_strdup("smime.p7s");
}
else {
- t->subtype = str_dup ("pgp-signature");
+ t->subtype = m_strdup("pgp-signature");
t->use_disp = 0;
t->disposition = DISPINLINE;
t->encoding = ENC7BIT;
t = mutt_new_body ();
t->type = TYPEMULTIPART;
- t->subtype = str_dup ("encrypted");
+ t->subtype = m_strdup("encrypted");
t->encoding = ENC7BIT;
t->use_disp = 0;
t->disposition = DISPINLINE;
t->parts = mutt_new_body ();
t->parts->type = TYPEAPPLICATION;
- t->parts->subtype = str_dup ("pgp-encrypted");
+ t->parts->subtype = m_strdup("pgp-encrypted");
t->parts->encoding = ENC7BIT;
t->parts->next = mutt_new_body ();
t->parts->next->type = TYPEAPPLICATION;
- t->parts->next->subtype = str_dup ("octet-stream");
+ t->parts->next->subtype = m_strdup("octet-stream");
t->parts->next->encoding = ENC7BIT;
t->parts->next->filename = outfile;
t->parts->next->use_disp = 1;
t->parts->next->disposition = DISPINLINE;
t->parts->next->unlink = 1; /* delete after sending the message */
- t->parts->next->d_filename = str_dup ("msg.asc"); /* non pgp/mime
+ t->parts->next->d_filename = m_strdup("msg.asc"); /* non pgp/mime
can save */
return t;
t = mutt_new_body ();
t->type = TYPEAPPLICATION;
- t->subtype = str_dup ("pkcs7-mime");
+ t->subtype = m_strdup("pkcs7-mime");
mutt_set_parameter ("name", "smime.p7m", &t->parameter);
mutt_set_parameter ("smime-type", "enveloped-data", &t->parameter);
t->encoding = ENCBASE64; /* The output of OpenSSL SHOULD be binary */
t->use_disp = 1;
t->disposition = DISPATTACH;
- t->d_filename = str_dup ("smime.p7m");
+ t->d_filename = m_strdup("smime.p7m");
t->filename = outfile;
t->unlink = 1; /*delete after sending the message */
t->parts = 0;
return;
is_pgp = (key->protocol == GPGME_PROTOCOL_OpenPGP);
- buf = xmalloc(str_len (prefix) + str_len (s) * 4 + 2);
+ buf = xmalloc(m_strlen(prefix) + m_strlen(s) * 4 + 2);
strcpy (buf, prefix); /* __STRCPY_CHECKED__ */
- p = buf + str_len (buf);
- if (is_pgp && str_len (s) == 40) { /* PGP v4 style formatted. */
+ p = buf + m_strlen(buf);
+ if (is_pgp && m_strlen(s) == 40) { /* PGP v4 style formatted. */
for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) {
*p++ = s[0];
*p++ = s[1];
if (notation->value) {
state_attach_puts (notation->value, s);
if (!(*notation->value
- && (notation->value[str_len (notation->value) - 1] ==
+ && (notation->value[m_strlen(notation->value) - 1] ==
'\n')))
state_attach_puts ("\n", s);
}
break;
offset = ftello (s->fpin);
- bytes -= (offset - last_pos); /* don't rely on str_len(buf) */
+ bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */
last_pos = offset;
if (!str_ncmp ("-----BEGIN PGP ", buf, 15)) {
/* Copy PGP material to an data container */
armored_data = create_gpgme_data ();
- gpgme_data_write (armored_data, buf, str_len (buf));
+ gpgme_data_write (armored_data, buf, m_strlen(buf));
while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) {
offset = ftello (s->fpin);
- bytes -= (offset - last_pos); /* don't rely on str_len(buf) */
+ bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */
last_pos = offset;
- gpgme_data_write (armored_data, buf, str_len (buf));
+ gpgme_data_write (armored_data, buf, m_strlen(buf));
if ((needpass && !str_cmp ("-----END PGP MESSAGE-----\n", buf))
|| (!needpass
if (!str_cmp (dn->key, key)) {
if (any)
fputs (" + ", fp);
- print_utf8 (fp, dn->value, str_len (dn->value));
+ print_utf8 (fp, dn->value, m_strlen(dn->value));
any = 1;
}
}
putc (' ', fp);
}
if (is_pgp)
- print_utf8 (fp, s, str_len (s));
+ print_utf8 (fp, s, m_strlen(s));
else
parse_and_print_user_id (fp, s);
putc ('\n', fp);
if (key->subkeys) {
s = key->subkeys->fpr;
fputs (_("Fingerprint: "), fp);
- if (is_pgp && str_len (s) == 40) {
+ if (is_pgp && m_strlen(s) == 40) {
for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) {
putc (*s, fp);
putc (s[1], fp);
s = subkey->keyid;
putc ('\n', fp);
- if (str_len (s) == 16)
+ if (m_strlen(s) == 16)
s += 8; /* display only the short keyID */
fprintf (fp, _("Subkey ....: 0x%s"), s);
if (subkey->revoked) {
patarr = p_new(char *, n + 1);
for (l = hints, n = 0; l; l = l->next) {
if (l->data && *l->data)
- patarr[n++] = str_dup (l->data);
+ patarr[n++] = m_strdup(l->data);
}
patarr[n] = NULL;
err = gpgme_op_keylist_ext_start (ctx, (const char **) patarr, secret, 0);
char *scratch;
char *t;
- if ((scratch = str_dup (str)) == NULL)
+ if ((scratch = m_strdup(str)) == NULL)
return hints;
for (t = strtok (scratch, " ,.:\"()<>\n"); t;
t = strtok (NULL, " ,.:\"()<>\n")) {
- if (str_len (t) > 3)
+ if (m_strlen(t) > 3)
hints = mutt_add_list (hints, t);
}
l = p_new(struct crypt_cache, 1);
l->next = id_defaults;
id_defaults = l;
- l->what = str_dup (whatfor);
- l->dflt = str_dup (resp);
+ l->what = m_strdup(whatfor);
+ l->dflt = m_strdup(resp);
}
}
*r_application &= ~APPLICATION_SMIME;
#endif
- keylist_size += str_len (s) + 4 + 1;
+ keylist_size += m_strlen(s) + 4 + 1;
p_realloc(&keylist, keylist_size);
sprintf (keylist + keylist_used, "%s0x%s%s", /* __SPRINTF_CHECKED__ */
keylist_used ? " " : "", s, forced_valid ? "!" : "");
}
- keylist_used = str_len (keylist);
+ keylist_used = m_strlen(keylist);
crypt_free_key (&key);
rfc822_free_address (&addr);
int sender_length = 0;
int uid_length = 0;
- sender_length = str_len (sender->mailbox);
+ sender_length = m_strlen(sender->mailbox);
for (uid = key->uids; uid && ret; uid = uid->next) {
- uid_length = str_len (uid->email);
+ uid_length = m_strlen(uid->email);
if (1 && (uid->email[0] == '<')
&& (uid->email[uid_length - 1] == '>')
&& (uid_length == sender_length + 2)
# include "config.h"
#endif
+#include <lib-lib/str.h>
#include <lib-lib/mem.h>
#include <lib-lib/macros.h>
#include "mutt_crypt.h"
#include "pgp.h"
-#include "lib/str.h"
#include <sys/wait.h>
#include <string.h>
/* no .p7c, .p10 support yet. */
- len = str_len (t) - 4;
+ len = m_strlen(t) - 4;
if (len > 0 && *(t + len) == '.') {
len++;
if (!ascii_strcasecmp ((t + len), "p7m"))
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "pager.h"
#include "mbyte.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <wchar.h>
answer_string = p_new(char, COLS + 1);
snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def == M_YES ? yes : no,
def == M_YES ? no : yes);
- answer_string_len = str_len (answer_string);
+ answer_string_len = m_strlen(answer_string);
printw ("%.*s%s", COLS - answer_string_len, msg, answer_string);
p_delete(&answer_string);
*redraw = REDRAW_FULL;
}
else {
- char *pc = p_new(char, str_len(prompt) + 3);
+ char *pc = p_new(char, m_strlen(prompt) + 3);
sprintf (pc, "%s: ", prompt); /* __SPRINTF_CHECKED__ */
mutt_ungetch (ch.op ? 0 : ch.ch, ch.op ? ch.op : 0);
}
else if (ch.ch <= '9' && ch.ch > '0') {
choice = ch.ch - '0';
- if (choice <= str_len (letters))
+ if (choice <= m_strlen(letters))
break;
}
}
}
mutt_format_string (dest, destlen, min_width, max_width,
- right_justify, ' ', s, str_len (s), arboreal);
+ right_justify, ' ', s, m_strlen(s), arboreal);
}
void mutt_format_s (char *dest,
wchar_t wc;
int w;
size_t k;
- size_t len = str_len (s);
+ size_t len = m_strlen(s);
mbstate_t mbstate;
memset (&mbstate, 0, sizeof (mbstate));
}
/*
- * mutt_strwidth is like str_len except that it returns the width
+ * mutt_strwidth is like m_strlenexcept that it returns the width
* refering to the number of characters cells.
*/
if (!s)
return 0;
- n = str_len (s);
+ n = m_strlen(s);
memset (&mbstate, 0, sizeof (mbstate));
for (w = 0; n && (k = mbrtowc (&wc, s, n, &mbstate)); s += k, n -= k) {
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_sasl.h"
#endif
-#include "lib/str.h"
#include "lib/debug.h"
#include <ctype.h>
unset_option (OPTHIDEREAD);
}
p_delete(&Context->pattern);
- Context->pattern = str_dup (buf);
+ Context->pattern = m_strdup(buf);
}
if ((op == OP_TOGGLE_READ && mutt_pattern_func (M_LIMIT, NULL) == 0) ||
mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0)
#define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0])
-size_t str_len (const char* s) {
+size_t m_strlen(const char* s) {
return (s ? strlen (s) : 0);
}
dirname = ".";
}
- if (str_len (basename) + 1 > l)
+ if (m_strlen(basename) + 1 > l)
return -1;
strfcpy (bn, basename, l);
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_curses.h"
#include "mutt_idna.h"
-#include "lib/str.h"
#include <stdio.h>
#include <string.h>
tmp[sizeof (tmp) - 1] = 0;
if (prefix) {
strfcpy (tmp, NONULL (Prefix), sizeof (tmp));
- tmplen = str_len (tmp);
+ tmplen = m_strlen(tmp);
p = tmp + tmplen;
tmplen = sizeof (tmp) - tmplen;
}
while (bytes > 0) {
if (fgets (p, tmplen - 1, f) == NULL)
break;
- bytes -= str_len (p);
+ bytes -= m_strlen(p);
if (*bufmax == *buflen)
p_realloc(&buf, *bufmax += 25);
- buf[(*buflen)++] = str_dup (tmp);
+ buf[(*buflen)++] = m_strdup(tmp);
}
if (buf && *bufmax == *buflen) { /* Do not smash memory past buf */
p_realloc(&buf, ++*bufmax);
if (*bufmax == *buflen)
p_realloc(&buf, *bufmax += 25);
- buf[(*buflen)++] = str_dup (tmp);
+ buf[(*buflen)++] = m_strdup(tmp);
bytes = Context->hdrs[n]->content->length;
if (inc_hdrs) {
if (*bufmax == *buflen)
p_realloc(&buf, *bufmax += 25);
- buf[(*buflen)++] = str_dup ("\n");
+ buf[(*buflen)++] = m_strdup("\n");
}
else
printw (_("%d: invalid message number.\n"), n);
if (EscChar && tmp[0] == EscChar[0] && tmp[1] != EscChar[0]) {
/* remove trailing whitespace from the line */
- p = tmp + str_len (tmp) - 1;
+ p = tmp + m_strlen(tmp) - 1;
while (p >= tmp && ISSPACE (*p))
*p-- = 0;
if (Context) {
if (!*p && cur) {
/* include the current message */
- p = tmp + str_len (tmp) + 1;
- snprintf (tmp + str_len (tmp),
- sizeof (tmp) - str_len (tmp), " %d",
+ p = tmp + m_strlen(tmp) + 1;
+ snprintf (tmp + m_strlen(tmp),
+ sizeof (tmp) - m_strlen(tmp), " %d",
cur->msgno + 1);
}
buf = be_include_messages (p, buf, &bufmax, &buflen,
if (buflen) {
buflen--;
strfcpy (tmp, buf[buflen], sizeof (tmp));
- tmp[str_len (tmp) - 1] = 0;
+ tmp[m_strlen(tmp) - 1] = 0;
p_delete(&buf[buflen]);
buf[buflen] = NULL;
continue;
str_cat (tmp, sizeof (tmp), "\n");
if (buflen == bufmax)
p_realloc(&buf, bufmax += 25);
- buf[buflen++] = str_dup (tmp[1] == '~' ? tmp + 1 : tmp);
+ buf[buflen++] = m_strdup(tmp[1] == '~' ? tmp + 1 : tmp);
}
tmp[0] = 0;
#endif
#include <lib-lib/macros.h>
+#include <lib-lib/str.h>
#include "mutt.h"
#include "copy.h"
#include "mx.h"
-#include "lib/str.h"
#include <sys/stat.h>
#include <errno.h>
goto bye;
} else if (flags & M_COMMAND) {
my_wcstombs (buf, buflen, state->wbuf, state->curpos);
- i = str_len (buf);
+ i = m_strlen(buf);
if (i && buf[i - 1] == '=' &&
mutt_var_value_complete (buf, buflen, i))
state->tabs = 0;
*numfiles = 1;
tfiles = p_new(char *, *numfiles);
mutt_expand_path (buf, buflen);
- tfiles[0] = str_dup (buf);
+ tfiles[0] = m_strdup(buf);
*files = tfiles;
}
rv = 0;
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <ctype.h>
{
int i;
- if ((str_len (s) < 3) || !*(s + 3) || !ISSPACE (*(s + 3)))
+ if ((m_strlen(s) < 3) || !*(s + 3) || !ISSPACE (*(s + 3)))
return 0;
for (i = 0; i < 7; i++)
if (str_ncasecmp (s, Weekdays[i], 3) == 0)
#include "alias.h"
-#include "lib/str.h"
+#include <lib-lib/str.h>
#include "lib/list.h"
#include "lib/rx.h"
#include <ctype.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "mutt.h"
#include "pgp.h"
/* for hexval */
#include "mime.h"
-#include "lib/str.h"
#include "lib/debug.h"
/****************
memcpy (uid, buf, ob - buf);
uid[ob - buf] = '\0';
}
- else if (ob - buf == n && (buf[n] = 0, str_len (buf) < n))
+ else if (ob - buf == n && (buf[n] = 0, m_strlen(buf) < n))
memcpy (uid, buf, n);
}
p_delete(&buf);
uid = p_new(pgp_uid_t, 1);
fix_uid (p);
- uid->addr = str_dup (p);
+ uid->addr = m_strdup(p);
uid->trust = trust;
uid->flags |= flags;
uid->parent = k;
#include <sys/stat.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "attach.h"
#include "lib.h"
-#include "lib/str.h"
#include "lib/debug.h"
typedef int handler_f (BODY *, STATE *);
if (fgets (line, MIN ((ssize_t) sizeof (line), len + 1), s->fpin) == NULL)
break;
- linelen = str_len (line);
+ linelen = m_strlen(line);
len -= linelen;
/*
while (len > 0) {
if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL)
return;
- len -= str_len (tmps);
+ len -= m_strlen(tmps);
if ((!str_ncmp (tmps, "begin", 5)) && ISSPACE (tmps[5]))
break;
}
while (len > 0) {
if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL)
return;
- len -= str_len (tmps);
+ len -= m_strlen(tmps);
if (!str_ncmp (tmps, "end", 3))
break;
pt = tmps;
stte->indent_len = 0;
if (stte->s->prefix) {
state_puts (stte->s->prefix, stte->s);
- stte->indent_len += str_len (stte->s->prefix);
+ stte->indent_len += m_strlen(stte->s->prefix);
}
if (stte->tag_level[RICH_EXCERPT]) {
while (x) {
if (stte->s->prefix) {
state_puts (stte->s->prefix, stte->s);
- stte->indent_len += str_len (stte->s->prefix);
+ stte->indent_len += m_strlen(stte->s->prefix);
}
else {
state_puts ("> ", stte->s);
- stte->indent_len += str_len ("> ");
+ stte->indent_len += m_strlen("> ");
}
x--;
}
{
const char *p;
- if (stte->buff_len < stte->buff_used + str_len (s)) {
+ if (stte->buff_len < stte->buff_used + m_strlen(s)) {
stte->buff_len += LONG_STRING;
p_realloc(&stte->buffer, stte->buff_len + 1);
}
if (s->prefix) {
state_puts (s->prefix, s);
- stte.indent_len += str_len (s->prefix);
+ stte.indent_len += m_strlen(s->prefix);
}
while (state != DONE) {
}
else {
wild = 1;
- btlen = str_len (t->data);
+ btlen = m_strlen(t->data);
}
if (a && a->parts)
snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype);
rfc1524_mailcap_lookup (a, type, entry, M_AUTOVIEW);
- fname = str_dup (a->filename);
+ fname = m_strdup(a->filename);
mutt_sanitize_filename (fname, 1);
rfc1524_expand_filename (entry->nametemplate, fname, tempfile,
sizeof (tempfile));
return d;
}
- size = str_len (c) + 1;
+ size = m_strlen(c) + 1;
d = dump_int (size, d, off);
lazy_realloc (&d, *off + size);
memcpy (d + *off, c, size);
crc = crc32 (crc, (unsigned char const *)
MUTTNG_HCACHE_ID "sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613",
- str_len
+ m_strlen
(MUTTNG_HCACHE_ID "sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613"));
#if HAVE_LANGINFO_CODESET
- crc = crc32 (crc, (unsigned char const *) Charset, str_len (Charset));
+ crc = crc32 (crc, (unsigned char const *) Charset, m_strlen(Charset));
crc =
crc32 (crc, (unsigned char const *) "HAVE_LANGINFO_CODESET",
- str_len ("HAVE_LANGINFO_CODESET"));
+ m_strlen("HAVE_LANGINFO_CODESET"));
#endif
#ifdef USE_POP
crc =
- crc32 (crc, (unsigned char const *) "USE_POP", str_len ("USE_POP"));
+ crc32 (crc, (unsigned char const *) "USE_POP", m_strlen("USE_POP"));
#endif
#ifdef MIXMASTER
crc =
crc32 (crc, (unsigned char const *) "MIXMASTER",
- str_len ("MIXMASTER"));
+ m_strlen("MIXMASTER"));
#endif
#ifdef USE_IMAP
crc =
- crc32 (crc, (unsigned char const *) "USE_IMAP", str_len ("USE_IMAP"));
+ crc32 (crc, (unsigned char const *) "USE_IMAP", m_strlen("USE_IMAP"));
#endif
#ifdef USE_NNTP
crc =
- crc32 (crc, (unsigned char const *) "USE_NNTP", str_len ("USE_NNTP"));
+ crc32 (crc, (unsigned char const *) "USE_NNTP", m_strlen("USE_NNTP"));
#endif
return crc;
}
}
MD5Init (&md5);
- MD5Update (&md5, (unsigned char *) folder, str_len (folder));
+ MD5Update (&md5, (unsigned char *) folder, m_strlen(folder));
MD5Final (md5sum, &md5);
ret = snprintf (mutt_hcache_per_folder_path, _POSIX_PATH_MAX,
/* this is needed for maildir style mailboxes */
if (oh) {
h->old = (*oh)->old;
- h->path = str_dup ((*oh)->path);
+ h->path = m_strdup((*oh)->path);
mutt_free_header (oh);
}
struct header_cache *h = p_new(HEADER_CACHE, 1);
int flags = VL_OWRITER | VL_OCREAT;
h->db = NULL;
- h->folder = str_dup(folder);
+ h->folder = m_strdup(folder);
h->crc = generate_crc32();
if (!path || path[0] == '\0')
int pagesize =
atoi (HeaderCachePageSize) ? atoi (HeaderCachePageSize) : 16384;
h->db = NULL;
- h->folder = str_dup (folder);
+ h->folder = m_strdup(folder);
h->crc = generate_crc32 ();
if (!path || path[0] == '\0') {
}
strncpy (path, h->folder, sizeof (path));
- strncat (path, filename, sizeof (path) - str_len (path));
+ strncat (path, filename, sizeof (path) - m_strlen(path));
key.dptr = path;
key.dsize = keylen (path);
}
strncpy (path, h->folder, sizeof (path));
- strncat (path, filename, sizeof (path) - str_len (path));
+ strncat (path, filename, sizeof (path) - m_strlen(path));
key.dptr = path;
key.dsize = keylen (path);
}
strncpy (path, h->folder, sizeof (path));
- strncat (path, filename, sizeof (path) - str_len (path));
+ strncat (path, filename, sizeof (path) - m_strlen(path));
key.dptr = path;
key.dsize = keylen (path);
#include "mutt_idna.h"
#include "mime.h"
-#include "lib/str.h"
+#include <lib-lib/str.h>
#include "lib/rx.h"
#include <ctype.h>
snprintf (dest, destlen, fmt,
(Tochars
&& ((i = mutt_user_is_recipient (hdr))) <
- str_len (Tochars)) ? Tochars[i] : ' ');
+ m_strlen(Tochars)) ? Tochars[i] : ' ');
break;
case 'u':
((i =
mutt_user_is_recipient
(hdr)) <
- str_len (Tochars)) ?
+ m_strlen(Tochars)) ?
Tochars[i] : ' ')));
mutt_format_s (dest, destlen, prefix, buf2);
break;
strfcpy (path, p, sizeof (path));
mutt_expand_path (path, sizeof (path));
if ((body = mutt_make_file_attach (path))) {
- body->description = str_dup (q);
+ body->description = m_strdup(q);
for (parts = msg->content; parts->next; parts = parts->next);
parts->next = body;
}
#endif
#include <lib-lib/macros.h>
-#include "lib/str.h"
+#include <lib-lib/str.h>
#include "mutt.h"
#include "mutt_curses.h"
buflen -= 2;
}
mutt_make_help (pbuf, buflen, _(items[i].name), menu, items[i].value);
- len = str_len (pbuf);
+ len = m_strlen(pbuf);
pbuf += len;
buflen -= len;
}
wchar_t wc;
int w;
size_t k;
- size_t len = str_len (*macro);
+ size_t len = m_strlen(*macro);
mbstate_t mbstate1, mbstate2;
memset (&mbstate1, 0, sizeof (mbstate1));
else {
col_a = COLS > 83 ? (COLS - 32) >> 2 : 12;
col_b = COLS > 49 ? (COLS - 10) >> 1 : 19;
- col = pad (f, str_len (t1), col_a);
+ col = pad (f, m_strlen(t1), col_a);
}
if (ismacro > 0) {
if (!split) {
col += print_macro (f, col_b - col - 4, &t2);
- if (str_len (t2) > col_b - col)
+ if (m_strlen(t2) > col_b - col)
t2 = "...";
}
}
SKIPWS (t3);
/* FIXME: this is completely wrong */
- if ((n = str_len (t3)) > COLS - col) {
+ if ((n = m_strlen(t3)) > COLS - col) {
n = COLS - col;
for (col_a = n; col_a > 0 && t3[col_a] != ' '; col_a--);
if (col_a)
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "compress.h"
#endif
-#include "lib/str.h"
#include "lib/rx.h"
#include <limits.h>
_mutt_expand_path (path, sizeof (path), 1);
p_delete(&pattern.data);
memset (&pattern, 0, sizeof (pattern));
- pattern.data = str_dup (path);
+ pattern.data = m_strdup(path);
}
#ifdef USE_COMPRESSED
else if (data & (M_APPENDHOOK | M_OPENHOOK | M_CLOSEHOOK)) {
mutt_check_simple (tmp, sizeof (tmp), DefaultHook);
p_delete(&pattern.data);
memset (&pattern, 0, sizeof (pattern));
- pattern.data = str_dup (tmp);
+ pattern.data = m_strdup(tmp);
}
if (data & (M_MBOXHOOK | M_SAVEHOOK | M_FCCHOOK)) {
mutt_expand_path (path, sizeof (path));
p_delete(&command.data);
memset (&command, 0, sizeof (command));
- command.data = str_dup (path);
+ command.data = m_strdup(path);
}
/* check to make sure that a matching hook doesn't already exist */
if (ImapAuthenticators && *ImapAuthenticators) {
/* Try user-specified list of authentication methods */
- methods = str_dup (ImapAuthenticators);
+ methods = m_strdup(ImapAuthenticators);
for (method = methods; method; method = delim) {
delim = strchr (method, ':');
*/
mutt_to_base64 ((unsigned char *) ibuf, (unsigned char *) obuf,
- str_len (obuf), sizeof (ibuf) - 2);
+ m_strlen(obuf), sizeof (ibuf) - 2);
str_cat (ibuf, sizeof (ibuf), "\r\n");
mutt_socket_write (idata->conn, ibuf);
unsigned int secret_len, chal_len;
int i;
- secret_len = str_len (password);
- chal_len = str_len (challenge);
+ secret_len = m_strlen(password);
+ chal_len = m_strlen(challenge);
/* passwords longer than MD5_BLOCK_LEN bytes are substituted with their MD5
* digests */
/* get an IMAP service ticket for the server */
snprintf (buf1, sizeof (buf1), "imap@%s", idata->conn->account.host);
request_buf.value = buf1;
- request_buf.length = str_len (buf1) + 1;
+ request_buf.length = m_strlen(buf1) + 1;
maj_stat = gss_import_name (&min_stat, &request_buf, gss_nt_service_name,
&target_name);
if (maj_stat != GSS_S_COMPLETE) {
/* server decides if principal can log in as user */
strncpy (buf1 + 4, idata->conn->account.user, sizeof (buf1) - 4);
request_buf.value = buf1;
- request_buf.length = 4 + str_len (idata->conn->account.user) + 1;
+ request_buf.length = 4 + m_strlen(idata->conn->account.user) + 1;
maj_stat = gss_wrap (&min_stat, context, 0, GSS_C_QOP_DEFAULT, &request_buf,
&cflags, &send_token);
if (maj_stat != GSS_S_COMPLETE) {
if (irc == IMAP_CMD_RESPOND) {
if (sasl_decode64
- (idata->cmd.buf + 2, str_len (idata->cmd.buf + 2), buf,
+ (idata->cmd.buf + 2, m_strlen(idata->cmd.buf + 2), buf,
LONG_STRING - 1,
&len) != SASL_OK) {
debug_print (1, ("error base64-decoding server response.\n"));
#include <ctype.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
-#include "lib/str.h"
#include "lib/debug.h"
#include "mutt.h"
if (!mx.mbox) {
home_namespace = 1;
mbox[0] = '\0'; /* Do not replace "" with "INBOX" here */
- mx.mbox = str_dup (ImapHomeNamespace);
+ mx.mbox = m_strdup(ImapHomeNamespace);
if (mutt_bit_isset (idata->capabilities, NAMESPACE)) {
mutt_message _("Getting namespaces...");
imap_unquote_string (buf); /* As kludgy as it gets */
mbox[sizeof (mbox) - 1] = '\0';
strncpy (mbox, buf, sizeof (mbox) - 1);
- n = str_len (mbox);
+ n = m_strlen(mbox);
debug_print (3, ("mbox: %s\n", mbox));
imap_unmunge_mbox_name (cur_folder);
if (!noinferiors && cur_folder[0] &&
- (n = str_len (mbox)) < LONG_STRING - 1) {
+ (n = m_strlen(mbox)) < LONG_STRING - 1) {
mbox[n++] = idata->delim;
mbox[n] = '\0';
}
if (!home_namespace)
showparents = 1;
imap_qualify_path (buf, sizeof (buf), &mx, mbox);
- state->folder = str_dup (buf);
+ state->folder = m_strdup(buf);
n--;
}
ctmp = mbox[n];
mbox[n] = '\0';
imap_qualify_path (buf, sizeof (buf), &mx, mbox);
- state->folder = str_dup (buf);
+ state->folder = m_strdup(buf);
}
mbox[n] = ctmp;
}
imap_add_folder (idata->delim, relpath, 1, 0, state, 1);
if (!state->folder) {
imap_qualify_path (buf, sizeof (buf), &mx, relpath);
- state->folder = str_dup (buf);
+ state->folder = m_strdup(buf);
}
}
}
/* no namespace, no folder: set folder to host only */
if (!state->folder) {
imap_qualify_path (buf, sizeof (buf), &mx, NULL);
- state->folder = str_dup (buf);
+ state->folder = m_strdup(buf);
}
if (home_namespace && mbox[0] != '\0') {
strfcpy (buf, NONULL (mx.mbox), sizeof (buf));
/* append a delimiter if necessary */
- n = str_len (buf);
+ n = m_strlen(buf);
if (n && (n < sizeof (buf) - 1) && (buf[n - 1] != idata->delim)) {
buf[n++] = idata->delim;
buf[n] = '\0';
if (mutt_get_field (_("Create mailbox: "), buf, sizeof (buf), M_FILE) < 0)
goto fail;
- if (!str_len (buf)) {
+ if (!m_strlen(buf)) {
mutt_error (_("Mailbox must have a name."));
mutt_sleep (1);
goto fail;
if (mutt_get_field (buf, newname, sizeof (newname), M_FILE) < 0)
goto fail;
- if (!str_len (newname)) {
+ if (!m_strlen(newname)) {
mutt_error (_("Mailbox must have a name."));
mutt_sleep (1);
goto fail;
if (isparent)
noselect = 1;
/* prune current folder from output */
- if (isparent || str_ncmp (name, mx.mbox, str_len (name)))
+ if (isparent || str_ncmp (name, mx.mbox, m_strlen(name)))
imap_add_folder (idata->delim, name, noselect, noinferiors, state,
isparent);
}
if (isparent)
strfcpy (relpath, "../", sizeof (relpath));
/* strip current folder from target, to render a relative path */
- else if (!str_ncmp (mx.mbox, folder, str_len (mx.mbox)))
- strfcpy (relpath, folder + str_len (mx.mbox), sizeof (relpath));
+ else if (!str_ncmp (mx.mbox, folder, m_strlen(mx.mbox)))
+ strfcpy (relpath, folder + m_strlen(mx.mbox), sizeof (relpath));
else
strfcpy (relpath, folder, sizeof (relpath));
}
imap_qualify_path (tmp, sizeof (tmp), &mx, folder);
- (state->entry)[state->entrylen].name = str_dup (tmp);
+ (state->entry)[state->entrylen].name = m_strdup(tmp);
/* mark desc with delim in browser if it can have subfolders */
- if (!isparent && !noinferiors && str_len (relpath) < sizeof (relpath) - 1) {
- relpath[str_len (relpath) + 1] = '\0';
- relpath[str_len (relpath)] = delim;
+ if (!isparent && !noinferiors && m_strlen(relpath) < sizeof (relpath) - 1) {
+ relpath[m_strlen(relpath) + 1] = '\0';
+ relpath[m_strlen(relpath)] = delim;
}
- (state->entry)[state->entrylen].desc = str_dup (relpath);
+ (state->entry)[state->entrylen].desc = m_strdup(relpath);
(state->entry)[state->entrylen].imap = 1;
/* delimiter at the root is useless. */
cmd_make_sequence (idata);
/* seq, space, cmd, \r\n\0 */
- outlen = str_len (idata->cmd.seq) + str_len (cmd) + 4;
+ outlen = m_strlen(idata->cmd.seq) + m_strlen(cmd) + 4;
out = p_new(char, outlen);
snprintf (out, outlen, "%s %s\r\n", idata->cmd.seq, cmd);
/* create sequence for command */
cmd_make_sequence (idata);
/* seq, space, cmd, \r\n\0 */
- outlen = str_len (idata->cmd.seq) + str_len (cmd) + 4;
+ outlen = m_strlen(idata->cmd.seq) + m_strlen(cmd) + 4;
out = p_new(char, outlen);
snprintf (out, outlen, "%s %s\r\n", idata->cmd.seq, cmd);
s = imap_next_word (s);
p_delete(&idata->capstr);
- idata->capstr = str_dup (s);
+ idata->capstr = m_strdup(s);
memset (idata->capabilities, 0, sizeof (idata->capabilities));
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "mutt.h"
#include "ascii.h"
#include "buffy.h"
#include <lib-lib/macros.h>
-#include "lib/str.h"
#include "lib/debug.h"
#include <unistd.h>
/* Clean up path and replace the one in the ctx */
imap_fix_path (idata, mx.mbox, buf, sizeof (buf));
p_delete(&(idata->mailbox));
- idata->mailbox = str_dup (buf);
+ idata->mailbox = m_strdup(buf);
imap_qualify_path (buf, sizeof (buf), &mx, idata->mailbox);
p_delete(&(ctx->path));
- ctx->path = str_dup (buf);
+ ctx->path = m_strdup(buf);
idata->ctx = ctx;
/* The mailbox name may or may not be quoted here. We could try to
* munge the server response and compare with quoted (or vise versa)
* but it is probably more efficient to just strncmp against both. */
- if (str_ncmp (mbox_unquoted, s, str_len (mbox_unquoted)) == 0
- || str_ncmp (mbox, s, str_len (mbox)) == 0) {
+ if (str_ncmp (mbox_unquoted, s, m_strlen(mbox_unquoted)) == 0
+ || str_ncmp (mbox, s, m_strlen(mbox)) == 0) {
s = imap_next_word (s);
s = imap_next_word (s);
if (isdigit ((unsigned char) *s)) {
int matchlen;
int i = 0;
- matchlen = str_len (dest);
+ matchlen = m_strlen(dest);
if (list_empty (Incoming))
return (-1);
for (i = 0; i < Incoming->length; i++) {
/* if the folder isn't selectable, append delimiter to force browse
* to enter it on second tab. */
if (noselect) {
- clen = str_len (list_word);
+ clen = m_strlen(list_word);
list_word[clen++] = delim;
list_word[clen] = '\0';
}
/* copy in first word */
if (!completions) {
strfcpy (completion, list_word, sizeof (completion));
- matchlen = str_len (completion);
+ matchlen = m_strlen(completion);
completions++;
continue;
}
#include <ctype.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "mutt.h"
#include "ascii.h"
#endif
#include <lib-lib/macros.h>
-#include "lib/str.h"
#include "lib/debug.h"
#if HAVE_STDINT_H
cache->uid = HEADER_DATA (h)->uid;
mutt_mktemp (path);
- cache->path = str_dup (path);
+ cache->path = m_strdup(path);
if (!(msg->fp = safe_fopen (path, "w+"))) {
p_delete(&cache->path);
return -1;
#ifdef USE_HCACHE
static size_t imap_hcache_keylen (const char *fn)
{
- return str_len (fn);
+ return m_strlen(fn);
}
/* msg_fetch_header: import IMAP FETCH response into an IMAP_HEADER.
flag_list = flag_list->next;
while (flag_list) {
- if (!ascii_strncasecmp (flag_list->data, flag, str_len (flag_list->data)))
+ if (!ascii_strncasecmp (flag_list->data, flag, m_strlen(flag_list->data)))
return 1;
flag_list = flag_list->next;
#include <sys/stat.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "mutt.h"
#include "imap_private.h"
#include "mx.h"
#include "mx_imap.h"
-#include "lib/str.h"
#include "url.h"
mutt_perror (tmp);
return (-1);
}
- msg->path = str_dup (tmp);
+ msg->path = m_strdup(tmp);
return 0;
}
void imap_utf7_encode (char **s)
{
if (Charset) {
- char *t = str_dup (*s);
+ char *t = m_strdup(*s);
if (!mutt_convert_string (&t, Charset, "UTF-8", 0)) {
char *u7 = utf8_to_utf7 (t, strlen (t), NULL, 0);
void imap_utf7_decode (char **s)
{
if (Charset) {
- char *t = utf7_to_utf8 (*s, str_len (*s), 0, 0);
+ char *t = utf7_to_utf8 (*s, m_strlen(*s), 0, 0);
if (t && !mutt_convert_string (&t, "UTF-8", Charset, 0)) {
p_delete(s);
mx->account.port = ImapPort;
mx->account.type = M_ACCT_TYPE_IMAP;
- c = str_dup (path);
+ c = m_strdup(path);
url_parse_ciss (&url, c);
if (!(url.scheme == U_IMAP || url.scheme == U_IMAPS) ||
return -1;
}
- mx->mbox = str_dup (url.path);
+ mx->mbox = m_strdup(url.path);
if (url.scheme == U_IMAPS)
mx->account.flags |= M_ACCT_SSL;
if (imap_parse_path (path, &target) < 0)
return;
- tlen = str_len (target.mbox);
+ tlen = m_strlen(target.mbox);
/* check whether we can do '=' substitution */
if (mx_get_magic (Maildir) == M_IMAP && !imap_parse_path (Maildir, &home)) {
- hlen = str_len (home.mbox);
+ hlen = m_strlen(home.mbox);
if (tlen && mutt_account_match (&home.account, &target.account) &&
!str_ncmp (home.mbox, target.mbox, hlen)) {
if (!hlen)
{
char *buf;
- buf = str_dup (src);
+ buf = m_strdup(src);
imap_utf7_encode (&buf);
imap_quote_string (dest, dlen, buf);
imap_unquote_string (s);
- buf = str_dup (s);
+ buf = m_strdup(s);
if (buf) {
imap_utf7_decode (&buf);
- strncpy (s, buf, str_len (s));
+ strncpy (s, buf, m_strlen(s));
}
p_delete(&buf);
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mx.h"
#include "init.h"
-#include "lib/str.h"
#include "lib/rx.h"
#include "lib/list.h"
#include "lib/debug.h"
} else if (ascii_strcmp ("muttng_folder_name", option->option) == 0 &&
CurrentFolder && *CurrentFolder) {
- size_t Maildirlength = str_len (Maildir);
+ size_t Maildirlength = m_strlen(Maildir);
/*
* if name starts with $folder, just strip it to keep hierarchy
*/
if (Maildirlength > 0 && str_ncmp (CurrentFolder, Maildir,
Maildirlength) == 0 &&
- str_len (CurrentFolder) > Maildirlength) {
+ m_strlen(CurrentFolder) > Maildirlength) {
val = CurrentFolder + Maildirlength;
if (Maildir[strlen(Maildir)-1]!='/')
val += 1;
* just silently ignore it */
if (!dst)
return (1);
- if (str_len ((char*) dst->data) == 0)
- dst->data = (unsigned long) str_dup (val);
+ if (m_strlen((char*) dst->data) == 0)
+ dst->data = (unsigned long) m_strdup(val);
else {
char* s = (char*) dst->data;
str_replace (&s, val);
}
- if (str_len (dst->init) == 0)
- dst->init = str_dup ((char*) dst->data);
+ if (m_strlen(dst->init) == 0)
+ dst->init = m_strdup((char*) dst->data);
return (1);
}
debug_print (1, ("orig == '%s'\n", tmp));
t = strchr (tmp, '=');
t++;
- l = str_len (t);
+ l = m_strlen(t);
if (l >= 2) {
if (t[l-1] == '"' && *t == '"') {
t[l-1] = '\0';
/* for synonym warning reports: adds synonym to end of list */
static void syn_add (struct option_t* n, struct option_t* o) {
syn_t* tmp = p_new(syn_t, 1);
- tmp->f = str_dup (CurRCFile);
+ tmp->f = m_strdup(CurRCFile);
tmp->l = CurRCLine;
tmp->n = n;
tmp->o = o;
if (!*list || last) {
t = p_new(LIST, 1);
- t->data = str_dup (str);
+ t->data = m_strdup(str);
if (last) {
last->next = t;
last = last->next;
}
/* Now t is the SPAM_LIST* that we want to modify. It is prepared. */
- t->template = str_dup (templ);
+ t->template = m_strdup(templ);
/* Find highest match number in template string */
t->nmatch = 0;
continue;
for (j = 0; b[j].name; j++)
- if (!ascii_strncasecmp (tmp->data, b[j].name, str_len (tmp->data))
- && (str_len (b[j].name) == str_len (tmp->data))) {
+ if (!ascii_strncasecmp (tmp->data, b[j].name, m_strlen(tmp->data))
+ && (m_strlen(b[j].name) == m_strlen(tmp->data))) {
res = 1;
break;
}
}
/* check for feature_* */
if (!res && ascii_strncasecmp (tmp->data, "feature_", 8) == 0 &&
- (j = str_len (tmp->data)) > 8) {
+ (j = m_strlen(tmp->data)) > 8) {
i = 0;
while (Features[i]) {
- if (str_len (Features[i]) == j-8 &&
+ if (m_strlen(Features[i]) == j-8 &&
ascii_strncasecmp (Features[i], tmp->data+8, j-8) == 0) {
res = 1;
break;
/* some cheap hacks that I expect to remove */
if (!str_casecmp(buf->data, "any"))
- a->major = str_dup("*/.*");
+ a->major = m_strdup("*/.*");
else if (!str_casecmp(buf->data, "none"))
- a->major = str_dup("cheap_hack/this_should_never_match");
+ a->major = m_strdup("cheap_hack/this_should_never_match");
else
- a->major = str_dup(buf->data);
+ a->major = m_strdup(buf->data);
if ((p = strchr(a->major, '/'))) {
*p = '\0';
a->minor = "unknown";
}
- len = str_len (a->minor);
+ len = m_strlen(a->minor);
tmpminor = p_new(char, len + 3);
strcpy(&tmpminor[1], a->minor); /* __STRCPY_CHECKED__ */
tmpminor[0] = '^';
mutt_extract_token (buf, s, 0);
if (!str_casecmp(buf->data, "any"))
- tmp = str_dup("*/.*");
+ tmp = m_strdup("*/.*");
else if (!str_casecmp(buf->data, "none"))
- tmp = str_dup("cheap_hack/this_should_never_match");
+ tmp = m_strdup("cheap_hack/this_should_never_match");
else
- tmp = str_dup(buf->data);
+ tmp = m_strdup(buf->data);
if ((minor = strchr(tmp, '/'))) {
*minor = '\0';
/* create a new alias */
tmp = p_new(ALIAS, 1);
tmp->self = tmp;
- tmp->name = str_dup (buf->data);
+ tmp->name = m_strdup(buf->data);
/* give the main addressbook code a chance */
if (CurrentMenu == MENU_ALIAS)
set_option (OPTMENUCALLER);
tmp = UserHeader;
last = NULL;
- l = str_len (buf->data);
+ l = m_strlen(buf->data);
if (buf->data[l - 1] == ':')
l--;
return;
mutt_option_value(ptr->option, buf, sizeof(buf));
- if (str_len(ptr->init) == 0 && buf && *buf)
- ptr->init = str_dup(buf);
+ if (m_strlen(ptr->init) == 0 && buf && *buf)
+ ptr->init = m_strdup(buf);
}
static struct option_t* add_option (const char* name, const char* init,
debug_print (1, ("adding $%s\n", name));
- option->option = str_dup (name);
+ option->option = m_strdup(name);
option->type = type;
if (init)
- option->init = dodup ? str_dup (init) : (char*) init;
+ option->init = dodup ? m_strdup(init) : (char*) init;
return (option);
}
if (src->init && *src->init) {
memset (&token, 0, sizeof(BUFFER));
memset (&in, 0, sizeof(BUFFER));
- len = str_len (src->init) + 2;
+ len = m_strlen(src->init) + 2;
in.data = p_new(char, len + 1);
snprintf (in.data, len, "\"%s\"", src->init);
in.dptr = in.data;
in.dsize = len;
mutt_extract_token (&token, &in, 0);
if (token.data && *token.data)
- *dst = str_dup (token.data);
+ *dst = m_strdup(token.data);
else
- *dst = str_dup ("");
+ *dst = m_strdup("");
p_delete(&in.data);
p_delete(&token.data);
} else
- *dst = str_dup ("");
+ *dst = m_strdup("");
} else
/* for non-string: take value as is */
- *dst = str_dup (src->init);
+ *dst = m_strdup(src->init);
return (1);
}
while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL) {
conv = ConfigCharset && (*ConfigCharset) && Charset;
if (conv) {
- currentline = str_dup (linebuf);
+ currentline = m_strdup(linebuf);
if (!currentline)
continue;
mutt_convert_string (¤tline, ConfigCharset, Charset, 0);
memset (&expn, 0, sizeof(expn));
expn.data = expn.dptr = line;
- expn.dsize = str_len (line);
+ expn.dsize = m_strlen(line);
*err->data = 0;
/* loop through all the possible prefixes (no, inv, ...) */
if (!str_ncmp (buffer, "set", 3)) {
for (num = 0; prefixes[num]; num++) {
- if (!str_ncmp (pt, prefixes[num], str_len (prefixes[num]))) {
- pt += str_len (prefixes[num]);
+ if (!str_ncmp (pt, prefixes[num], m_strlen(prefixes[num]))) {
+ pt += m_strlen(prefixes[num]);
break;
}
}
if (str_ncmp (buffer, "set", 3) == 0) {
strfcpy (var, pt, sizeof(var));
/* ignore the trailing '=' when comparing */
- var[str_len (var) - 1] = 0;
+ var[m_strlen(var) - 1] = 0;
if (!(option = hash_find (ConfigOptions, var)))
return 0; /* no such variable. */
else {
/* on one of the systems I use, getcwd() does not return the same prefix
as is listed in the passwd file */
if ((p = getenv ("HOME")))
- Homedir = str_dup (p);
+ Homedir = m_strdup(p);
/* Get some information about the user */
if ((pw = getpwuid (getuid ()))) {
char rnbuf[STRING];
- Username = str_dup (pw->pw_name);
+ Username = m_strdup(pw->pw_name);
if (!Homedir)
- Homedir = str_dup (pw->pw_dir);
+ Homedir = m_strdup(pw->pw_dir);
- Realname = str_dup (mutt_gecos_name (rnbuf, sizeof(rnbuf), pw));
- Shell = str_dup (pw->pw_shell);
+ Realname = m_strdup(mutt_gecos_name (rnbuf, sizeof(rnbuf), pw));
+ Shell = m_strdup(pw->pw_shell);
endpwent ();
}
else {
exit (1);
}
if ((p = getenv ("USER")))
- Username = str_dup (p);
+ Username = m_strdup(p);
else {
mutt_endwin (NULL);
fputs (_("unable to determine username"), stderr);
exit (1);
}
- Shell = str_dup ((p = getenv ("SHELL")) ? p : "/bin/sh");
+ Shell = m_strdup((p = getenv ("SHELL")) ? p : "/bin/sh");
}
debug_start(Homedir);
strfcpy (buffer, p, sizeof(buffer)); /* save the domain for below */
}
else
- Hostname = str_dup (utsname.nodename);
+ Hostname = m_strdup(utsname.nodename);
#ifndef DOMAIN
#define DOMAIN buffer
if (!p && getdnsdomainname (buffer, sizeof(buffer)) == -1)
- Fqdn = str_dup ("@");
+ Fqdn = m_strdup("@");
else
#endif /* DOMAIN */
if (*DOMAIN != '@') {
- Fqdn = p_new(char, str_len(DOMAIN) + str_len(Hostname) + 2);
+ Fqdn = p_new(char, m_strlen(DOMAIN) + m_strlen(Hostname) + 2);
sprintf (Fqdn, "%s.%s", NONULL (Hostname), DOMAIN); /* __SPRINTF_CHECKED__ */
}
else
- Fqdn = str_dup (NONULL (Hostname));
+ Fqdn = m_strdup(NONULL (Hostname));
#ifdef USE_NNTP
{
while (*q && !isspace(*q))
q++;
*q = '\0';
- NewsServer = str_dup (p);
+ NewsServer = m_strdup(p);
fclose (f);
}
}
if ((p = getenv ("NNTPSERVER")))
- NewsServer = str_dup (p);
+ NewsServer = m_strdup(p);
#endif
if ((p = getenv ("MAIL")))
- Spoolfile = str_dup (p);
+ Spoolfile = m_strdup(p);
else if ((p = getenv ("MAILDIR")))
- Spoolfile = str_dup (p);
+ Spoolfile = m_strdup(p);
else {
#ifdef HOMESPOOL
mutt_concat_path (buffer, NONULL (Homedir), MAILPATH, sizeof(buffer));
#else
mutt_concat_path (buffer, MAILPATH, NONULL (Username), sizeof(buffer));
#endif
- Spoolfile = str_dup (buffer);
+ Spoolfile = m_strdup(buffer);
}
if ((p = getenv ("MAILCAPS")))
- MailcapPath = str_dup (p);
+ MailcapPath = m_strdup(p);
else {
/* Default search path from RFC1524 */
MailcapPath =
- str_dup ("~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR
+ m_strdup("~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR
"/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap");
}
- Tempdir = str_dup ((p = getenv ("TMPDIR")) ? p : "/tmp");
+ Tempdir = m_strdup((p = getenv ("TMPDIR")) ? p : "/tmp");
p = getenv ("VISUAL");
if (!p) {
if (!p)
p = "vi";
}
- Editor = str_dup (p);
- Visual = str_dup (p);
+ Editor = m_strdup(p);
+ Visual = m_strdup(p);
if ((p = getenv ("REPLYTO")) != NULL) {
BUFFER buf, token;
memset (&buf, 0, sizeof(buf));
buf.data = buf.dptr = buffer;
- buf.dsize = str_len (buffer);
+ buf.dsize = m_strlen(buffer);
memset (&token, 0, sizeof(token));
parse_my_hdr (&token, &buf, 0, &err);
NONULL (Homedir));
default_rc = 1;
- Muttrc = str_dup (buffer);
+ Muttrc = m_strdup(buffer);
}
else {
strfcpy (buffer, Muttrc, sizeof(buffer));
p_delete(&Muttrc);
mutt_expand_path (buffer, sizeof(buffer));
- Muttrc = str_dup (buffer);
+ Muttrc = m_strdup(buffer);
}
p_delete(&AliasFile);
- AliasFile = str_dup (NONULL (Muttrc));
+ AliasFile = m_strdup(NONULL (Muttrc));
/* Process the global rc file if it exists and the user hasn't explicity
requested not to via "-n". */
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mapping.h"
#include "mutt_crypt.h"
-#include "lib/str.h"
#include <stdlib.h>
#include <string.h>
map = allocKeys (len, buf);
map->op = op;
- map->macro = str_dup (macro);
- map->descr = str_dup (descr);
+ map->macro = m_strdup(macro);
+ map->descr = m_strdup(descr);
tmp = Keymaps[menu];
for (i = 0; bindings[i].name; i++) {
if (!ascii_strncasecmp (start, bindings[i].name, len) &&
- str_len (bindings[i].name) == len)
+ m_strlen(bindings[i].name) == len)
return bindings[i].op;
}
static void push_string (char *s)
{
- char *pp, *p = s + str_len (s) - 1;
+ char *pp, *p = s + m_strlen(s) - 1;
size_t l;
int i, op = OP_NULL;
FOREVER {
strfcpy (s, km_keyname (map->keys[p]), len);
- len -= (l = str_len (s));
+ len -= (l = m_strlen(s));
if (++p >= map->len || !len)
return (1);
}
else {
if (MoreArgs (s)) {
- seq = str_dup (buf->data);
+ seq = m_strdup(buf->data);
mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
if (MoreArgs (s)) {
&& CurrentMenu != MENU_PAGER)
bindings = OpGeneric;
- ops[nops] = get_op (bindings, function, str_len (function));
+ ops[nops] = get_op (bindings, function, m_strlen(function));
if (ops[nops] == OP_NULL && CurrentMenu != MENU_PAGER)
- ops[nops] = get_op (OpGeneric, function, str_len (function));
+ ops[nops] = get_op (OpGeneric, function, m_strlen(function));
if (ops[nops] == OP_NULL) {
mutt_flushinp ();
noinst_LIBRARIES = liblib.a
-liblib_a_SOURCES = mem.c
+liblib_a_SOURCES = mem.h str.h \
+ str.c
-noinst_HEADERS = mem.h
+noinst_HEADERS = mem.h str.h
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright © 2006 Pierre Habouzit
+ */
+
#ifndef MUTT_LIB_LIB_MACROS_H
#define MUTT_LIB_LIB_MACROS_H
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Author: Pierre Habouzit <madcoder@debian.org>
+ * Copyright © 2006 Pierre Habouzit
*/
#ifndef MUTT_LIB_LIB_MEM_H
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "lib.h"
-#include "lib/str.h"
#include "lib/debug.h"
extern short Umask;
char abs_oldpath[_POSIX_PATH_MAX];
if ((getcwd (abs_oldpath, sizeof abs_oldpath) == NULL) ||
- (str_len (abs_oldpath) + 1 + str_len (oldpath) + 1 >
+ (m_strlen(abs_oldpath) + 1 + m_strlen(oldpath) + 1 >
sizeof abs_oldpath))
return -1;
{
const char *fmt = "%s/%s";
- if (!*fname || (*dir && dir[str_len (dir) - 1] == '/'))
+ if (!*fname || (*dir && dir[m_strlen(dir) - 1] == '/'))
fmt = "%s%s";
snprintf (d, l, fmt, dir, fname);
#include <stdarg.h>
#include <time.h>
+#include <lib-lib/str.h>
#include "debug.h"
#include "mutt.h"
#include "globals.h"
-#include "str.h"
short DebugLevel = -1;
FILE* DebugFile = NULL;
#include <stdlib.h>
#include <stdio.h>
+#include <lib-lib/str.h>
#include "exit.h"
-#include "str.h"
#include <lib-lib/macros.h>
/* XXX remove after modularization*/
#include <string.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "list.h"
-#include "str.h"
list2_t* list_new (void) {
return p_new(list2_t, 1);
if (!str || !*str || !delim || !*delim)
return (NULL);
- tmp = str_dup (str);
+ tmp = m_strdup(str);
for (p = strtok (tmp, delim); p; p = strtok (NULL, delim)) {
- list_push_back (&ret, str_dup (p));
+ list_push_back (&ret, m_strdup(p));
}
p_delete(&tmp);
return (ret);
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "rx.h"
-#include "str.h"
rx_t *rx_compile (const char *s, int flags) {
rx_t *pp = p_new(rx_t, 1);
- pp->pattern = str_dup (s);
+ pp->pattern = m_strdup(s);
pp->rx = p_new(regex_t, 1);
if (REGCOMP(pp->rx, NONULL (s), flags) != 0)
rx_free (&pp);
#include <ctype.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "str.h"
-char *str_dup (const char *s)
-{
- if (!s || !*s)
- return NULL;
- return p_dupstr(s, str_len(s));
-}
-
char *str_cat (char *d, size_t l, const char *s)
{
char *p = d;
return strncasecmp (NONULL (a), NONULL (b), l);
}
-size_t str_len (const char *a)
-{
- return a ? strlen (a) : 0;
-}
-
int str_coll (const char *a, const char *b)
{
return strcoll (NONULL (a), NONULL (b));
void str_replace (char **p, const char *s)
{
p_delete(p);
- *p = str_dup (s);
+ *p = m_strdup(s);
}
void str_adjust (char **p)
{
if (!p || !*p)
return;
- p_realloc(p, str_len (*p) + 1);
+ p_realloc(p, m_strlen(*p) + 1);
}
/* convert all characters in the string to lowercase */
}
int str_eq (const char* s1, const char* s2) {
- int l = str_len (s1);
+ int l = m_strlen(s1);
- if (l != str_len (s2))
+ if (l != m_strlen(s2))
return (0);
return (str_ncmp (s1, s2, l) == 0);
}
void str_skip_trailws (char *s) {
char *p;
- for (p = s + str_len (s) - 1; p >= s && ISSPACE (*p); p--)
+ for (p = s + m_strlen(s) - 1; p >= s && ISSPACE (*p); p--)
*p = 0;
}
* safety wrappers/replacements
* (mostly only difference: safely handle NULL strings)
*/
-char *str_dup (const char*);
char *str_cat (char*, size_t, const char*);
char *str_ncat (char*, size_t, const char*, size_t);
int str_cmp (const char*, const char*);
int str_ncmp (const char*, const char*, size_t);
int str_ncasecmp (const char*, const char*, size_t);
int str_coll (const char*, const char*);
-size_t str_len (const char*);
/*
* tools
#include <string.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "list.h"
-#include "lib/str.h"
LIST *mutt_copy_list (LIST * p) {
LIST *t, *r = NULL, *l = NULL;
for (; p; p = p->next) {
t = p_new(LIST, 1);
- t->data = str_dup (p->data);
+ t->data = m_strdup(p->data);
t->next = NULL;
if (l) {
r->next = t;
LIST *mutt_add_list (LIST * head, const char *data) {
- size_t len = str_len (data);
+ size_t len = m_strlen(data);
return (mutt_add_list_n (head, data, len ? len + 1 : 0));
}
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_idna.h"
#include "xterm.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <string.h>
}
if (subject)
- msg->env->subject = str_dup (subject);
+ msg->env->subject = m_strdup(subject);
if (includeFile)
infile = includeFile;
fin = NULL;
mutt_mktemp (buf);
- tempfile = str_dup (buf);
+ tempfile = m_strdup(buf);
if (draftFile)
msg->env = mutt_read_rfc822_header (fin, NULL, 1, 0);
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "compress.h"
#endif
-#include "lib/str.h"
#include "lib/debug.h"
#include <sys/stat.h>
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "imap.h"
#endif
-#include "lib/str.h"
#include <string.h>
#include <stdlib.h>
{
wchar_t wc;
size_t k;
- size_t n = str_len ((char *) s);
+ size_t n = m_strlen((char *) s);
mbstate_t mbstate;
memset (&mbstate, 0, sizeof (mbstate));
cols = COLS - shift - SidebarWidth;
else
cols = COLS - shift;
- mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, str_len (s), 1);
+ mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, m_strlen(s), 1);
tmpbuf[n - 1] = 0;
snprintf (s, n, "%s", tmpbuf); /* overkill */
p_delete(&tmpbuf);
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "thread.h"
#include "hcache.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <sys/stat.h>
}
}
else {
- *tgt = str_dup (path);
+ *tgt = m_strdup(path);
break;
}
}
/* first, copy unknown sequences */
if ((ofp = fopen (sequences, "r"))) {
while ((buff = mutt_read_line (buff, &s, ofp, &l))) {
- if (!str_ncmp (buff, seq_unseen, str_len (seq_unseen)))
+ if (!str_ncmp (buff, seq_unseen, m_strlen(seq_unseen)))
continue;
- if (!str_ncmp (buff, seq_flagged, str_len (seq_flagged)))
+ if (!str_ncmp (buff, seq_flagged, m_strlen(seq_flagged)))
continue;
- if (!str_ncmp (buff, seq_replied, str_len (seq_replied)))
+ if (!str_ncmp (buff, seq_replied, m_strlen(seq_replied)))
continue;
fprintf (nfp, "%s\n", buff);
snprintf (sequences, sizeof (sequences), "%s/.mh_sequences", ctx->path);
if ((ofp = fopen (sequences, "r"))) {
while ((buff = mutt_read_line (buff, &sz, ofp, &line))) {
- if (unseen && !strncmp (buff, seq_unseen, str_len (seq_unseen))) {
+ if (unseen && !strncmp (buff, seq_unseen, m_strlen(seq_unseen))) {
fprintf (nfp, "%s %d\n", buff, n);
unseen_done = 1;
}
else if (flagged
- && !strncmp (buff, seq_flagged, str_len (seq_flagged))) {
+ && !strncmp (buff, seq_flagged, m_strlen(seq_flagged))) {
fprintf (nfp, "%s %d\n", buff, n);
flagged_done = 1;
}
else if (replied
- && !strncmp (buff, seq_replied, str_len (seq_replied))) {
+ && !strncmp (buff, seq_replied, m_strlen(seq_replied))) {
fprintf (nfp, "%s %d\n", buff, n);
replied_done = 1;
}
if (subdir) {
snprintf (buf, sizeof (buf), "%s/%s", subdir, fname);
- h->path = str_dup (buf);
+ h->path = m_strdup(buf);
}
else
- h->path = str_dup (fname);
+ h->path = m_strdup(fname);
entry = p_new(struct maildir, 1);
entry->h = h;
{
const char *p = strchr (fn, ':');
- return p ? (size_t) (p - fn) : str_len (fn);
+ return p ? (size_t) (p - fn) : m_strlen(fn);
}
#endif
hdr->read ? "S" : "", hdr->deleted ? "T" : "",
NONULL (hdr->maildir_flags));
if (hdr->maildir_flags)
- qsort (tmp, str_len (tmp), 1, ch_compar);
+ qsort (tmp, m_strlen(tmp), 1, ch_compar);
snprintf (dest, destlen, ":2,%s", tmp);
}
}
}
else {
debug_print (2, ("success.\n"));
- msg->path = str_dup (path);
+ msg->path = m_strdup(path);
break;
}
}
for (p = md; p; p = p->next) {
maildir_canon_filename (buf, p->h->path, sizeof (buf));
- p->canon_fname = str_dup (buf);
+ p->canon_fname = m_strdup(buf);
hash_insert (fnames, p->canon_fname, p, 0);
}
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "charset.h"
#include "mutt_idna.h"
-#include "lib/str.h"
#include "lib/debug.h"
/* The low-level interface we use. */
int mutt_idna_to_local (const char *in, char **out, int flags)
{
- *out = str_dup (in);
+ *out = m_strdup(in);
return 1;
}
int mutt_local_to_idna (const char *in, char **out)
{
- *out = str_dup (in);
+ *out = m_strdup(in);
return 0;
}
if ((flags & MI_MAY_BE_IRREVERSIBLE) == 0) {
int irrev = 0;
char *t2 = NULL;
- char *tmp = str_dup (*out);
+ char *tmp = m_strdup(*out);
if (mutt_convert_string (&tmp, Charset, "utf-8", M_ICONV_HOOK_FROM) == -1)
irrev = 1;
notrans:
p_delete(out);
- *out = str_dup (in);
+ *out = m_strdup(in);
return 1;
}
int mutt_local_to_idna (const char *in, char **out)
{
int rv = 0;
- char *tmp = str_dup (in);
+ char *tmp = m_strdup(in);
*out = NULL;
p_delete(&tmp);
if (rv < 0) {
p_delete(out);
- *out = str_dup (in);
+ *out = m_strdup(in);
}
return rv;
}
if (!p || !p[1])
return -1;
*user = p_dupstr(mbx, p - mbx);
- *domain = str_dup (p + 1);
+ *domain = m_strdup(p + 1);
return 0;
}
if (mutt_local_to_idna (domain, &tmp) < 0) {
e = 1;
if (err)
- *err = str_dup (domain);
+ *err = m_strdup(domain);
}
else {
- p_realloc(&a->mailbox, str_len(user) + str_len(tmp) + 2);
+ p_realloc(&a->mailbox, m_strlen(user) + m_strlen(tmp) + 2);
sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */
}
continue;
if (mutt_idna_to_local (domain, &tmp, 0) == 0) {
- p_realloc(&a->mailbox, str_len(user) + str_len(tmp) + 2);
+ p_realloc(&a->mailbox, m_strlen(user) + m_strlen(tmp) + 2);
sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */
}
return a->mailbox;
}
- p_realloc(&buff, str_len(tmp) + str_len(user) + 2);
+ p_realloc(&buff, m_strlen(tmp) + m_strlen(user) + 2);
sprintf (buff, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */
p_delete(&tmp);
p_delete(&user);
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "ascii.h"
#include "enter.h"
-#include "lib/str.h"
#if defined (USE_SSL) || (defined (USE_GNUTLS) && defined (HAVE_GNUTLS_OPENSSL_H))
#include <openssl/ssl.h>
/* Create hostname:port string and tell libesmtp */
/* len = SmtpHost len + colon + max port (65536 => 5 chars) + terminator */
- hostportlen = str_len (SmtpHost) + 7;
+ hostportlen = m_strlen(SmtpHost) + 7;
hostportstr = p_new(char, hostportlen);
snprintf (hostportstr, hostportlen, "%s:%d", SmtpHost, SmtpPort);
if (!smtp_set_server (session, hostportstr))
if (ret)
return getnameinfo_err (ret);
- if (outlen < str_len (hbuf) + str_len (pbuf) + 2)
+ if (outlen < m_strlen(hbuf) + m_strlen(pbuf) + 2)
return SASL_BUFOVER;
snprintf (out, outlen, "%s;%s", hbuf, pbuf);
if (mutt_get_field (prompt, resp, sizeof (resp), 0))
return SASL_FAIL;
- interaction->len = str_len (resp) + 1;
+ interaction->len = m_strlen(resp) + 1;
interaction->result = p_dupstr(resp, interaction->len - 1);
interaction++;
}
}
if (len)
- *len = str_len (*result);
+ *len = m_strlen(*result);
return SASL_OK;
}
if (mutt_account_getpass (account))
return SASL_FAIL;
- len = str_len (account->pass);
+ len = m_strlen(account->pass);
*psecret = xmalloc(sizeof(sasl_secret_t) + len);
(*psecret)->len = len;
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_idna.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <unistd.h>
return -1;
}
- len = str_len (buf);
+ len = m_strlen(buf);
if ((rc = conn->conn_write (conn, buf, len)) < 0) {
debug_print (1, ("error writing, closing socket\n"));
mutt_socket_close (conn);
debug_print (dbg, ("< %s\n", buf));
- /* number of bytes read, not str_len */
+ /* number of bytes read, not m_strlen*/
return i + 1;
}
int rc;
int save_errno;
- if (str_len (Preconnect)) {
+ if (m_strlen(Preconnect)) {
debug_print (2, ("Executing preconnect: %s\n", Preconnect));
rc = mutt_system (Preconnect);
debug_print (2, ("Preconnect result: %d\n", rc));
#include <string.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_curses.h"
#include "mutt_ssl.h"
-#include "lib/str.h"
#include "lib/debug.h"
#if OPENSSL_VERSION_NUMBER >= 0x00904000L
c = strstr (line, ndx);
if (c) {
- c += str_len (ndx);
+ c += m_strlen(ndx);
c2 = strchr (c, '/');
if (c2)
*c2 = '\0';
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_menu.h"
#include "mutt_ssl.h"
-#include "lib/str.h"
#include "lib/rx.h"
typedef struct _tlssockdata {
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_socket.h"
#include "mutt_tunnel.h"
-#include "lib/str.h"
#include <netinet/in.h>
#include <sys/types.h>
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_crypt.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <string.h>
mktemp (s);
if (period != NULL) {
*period = '.';
- sl = str_len (s);
+ sl = m_strlen(s);
strfcpy (s + sl, period, l - sl);
}
}
b->parts = NULL;
b->next = NULL;
- b->filename = str_dup (tmp);
+ b->filename = m_strdup(tmp);
b->use_disp = use_disp;
b->unlink = 1;
if (mutt_is_text_part (b))
b->noconv = 1;
- b->xtype = str_dup (b->xtype);
- b->subtype = str_dup (b->subtype);
- b->form_name = str_dup (b->form_name);
- b->filename = str_dup (b->filename);
- b->d_filename = str_dup (b->d_filename);
- b->description = str_dup (b->description);
+ b->xtype = m_strdup(b->xtype);
+ b->subtype = m_strdup(b->subtype);
+ b->form_name = m_strdup(b->form_name);
+ b->filename = m_strdup(b->filename);
+ b->d_filename = m_strdup(b->d_filename);
+ b->description = m_strdup(b->description);
/*
* we don't seem to need the HEADER structure currently.
for (par = b->parameter, ppar = &b->parameter; par;
ppar = &(*ppar)->next, par = par->next) {
*ppar = mutt_new_parameter ();
- (*ppar)->attribute = str_dup (par->attribute);
- (*ppar)->value = str_dup (par->value);
+ (*ppar)->attribute = m_strdup(par->attribute);
+ (*ppar)->value = m_strdup(par->value);
}
mutt_stamp_attachment (b);
int mutt_matches_ignore (const char *s, LIST * t)
{
for (; t; t = t->next) {
- if (!ascii_strncasecmp (s, t->data, str_len (t->data))
+ if (!ascii_strncasecmp (s, t->data, m_strlen(t->data))
|| *t->data == '*')
return 1;
}
#ifdef USE_IMAP
/* if folder = imap[s]://host/: don't append slash */
if (imap_is_magic (NONULL (Maildir), NULL) == M_IMAP &&
- Maildir[str_len (Maildir) - 1] == '/')
+ Maildir[m_strlen(Maildir) - 1] == '/')
strfcpy (p, NONULL (Maildir), sizeof (p));
else
#endif
else
strfcpy (dest, pw->pw_gecos, destlen);
- pwnl = str_len (pw->pw_name);
+ pwnl = m_strlen(pw->pw_name);
for (idx = 0; dest[idx]; idx++) {
if (dest[idx] == '&') {
}
q = mutt_new_parameter ();
- q->attribute = str_dup (attribute);
- q->value = str_dup (value);
+ q->attribute = m_strdup(attribute);
+ q->value = m_strdup(value);
q->next = *p;
*p = q;
}
}
*q = 0;
- if (str_ncmp (s, Maildir, (len = str_len (Maildir))) == 0 &&
+ if (str_ncmp (s, Maildir, (len = m_strlen(Maildir))) == 0 &&
s[len] == '/') {
*s++ = '=';
- memmove (s, s + len, str_len (s + len) + 1);
+ memmove (s, s + len, m_strlen(s + len) + 1);
}
- else if (str_ncmp (s, Homedir, (len = str_len (Homedir))) == 0 &&
+ else if (str_ncmp (s, Homedir, (len = m_strlen(Homedir))) == 0 &&
s[len] == '/') {
*s++ = '~';
- memmove (s, s + len - 1, str_len (s + len - 1) + 1);
+ memmove (s, s + len - 1, m_strlen(s + len - 1) + 1);
}
}
size_t slen;
int found = 0;
- slen = str_len (src);
+ slen = m_strlen(src);
destlen--;
for (p = fmt, d = dest; destlen && *p; p++) {
ret++;
s++;
}
- return (str_len (p));
+ return (m_strlen(p));
}
void mutt_FormatString (char *dest, /* output buffer */
if (count > col) {
count -= col; /* how many columns left on this line */
mutt_FormatString (buf, sizeof (buf), src, callback, data, flags);
- wid = str_len (buf);
+ wid = m_strlen(buf);
if (count > wid) {
count -= wid; /* how many chars to pad */
memset (wptr, ch, count);
*p = '_';
}
- if ((len = str_len (buf)) + wlen > destlen)
+ if ((len = m_strlen(buf)) + wlen > destlen)
len = (destlen - wlen > 0) ? (destlen - wlen) : 0;
memcpy (wptr, buf, len);
then we assume it is a commmand to run instead of a normal file. */
FILE *mutt_open_read (const char *path, pid_t * thepid)
{
- int len = str_len (path);
+ int len = m_strlen(path);
FILE *f;
if (path[len - 1] == '|') {
- char *s = str_dup (path);
+ char *s = m_strdup(path);
/* read from a pipe */
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_crypt.h"
-#include "lib/str.h"
#include "lib/list.h"
#include "lib/debug.h"
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));
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;
#include <sys/stat.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "mutt.h"
#include "nntp.h"
#include "mx.h"
#include "mx_nntp.h"
-#include "lib/str.h"
#include "url.h"
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "rfc1524.h"
#include "rfc2047.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <unistd.h>
len = sizeof (group);
strfcpy (group, line, len);
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, group)) == NULL) {
- data = xmalloc(sizeof(NNTP_DATA) + str_len(group) + 1);
+ data = xmalloc(sizeof(NNTP_DATA) + m_strlen(group) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
return 0;
rewind (index);
while (fgets (buf, sizeof (buf), index)) {
- buf[str_len (buf) - 1] = 0; /* strip ending '\n' */
+ buf[m_strlen(buf) - 1] = 0; /* strip ending '\n' */
if (!str_ncmp (buf, "#: ", 3) &&
!str_casecmp (buf + 3, news->conn->account.host))
break;
break;
sscanf (cp + 1, "%s %d %d", file, &l, &m);
if (!str_cmp (buf, "ALL")) {
- news->cache = str_dup (file);
+ news->cache = m_strdup(file);
news->newgroups_time = m;
}
else if (news->newsgroups) {
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, buf)) == NULL) {
- data = xmalloc(sizeof(NNTP_DATA) + str_len(buf) + 1);
+ data = xmalloc(sizeof(NNTP_DATA) + m_strlen(buf) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, buf);
data->nserv = news;
hash_insert (news->newsgroups, data->group, data, 0);
nntp_add_to_list (news, data);
}
- data->cache = str_dup (file);
+ data->cache = m_strdup(file);
t = 0;
if (!data->firstMessage || data->lastMessage < m)
t = 1;
acct->port = NNTP_PORT;
acct->type = M_ACCT_TYPE_NNTP;
- c = str_dup (server);
+ c = m_strdup(server);
url_parse_ciss (&url, c);
if (url.scheme == U_NNTP || url.scheme == U_NNTPS) {
{
ciss_url_t url;
- url.path = str_dup (line);
+ url.path = m_strdup(line);
mutt_account_tourl (acct, &url);
url_ciss_tostring (&url, line, len, 0);
p_delete(&url.path);
return NULL;
}
- buf = p = p_new(char, str_len (server) + 10);
+ buf = p = p_new(char, m_strlen(server) + 10);
if (url_check_scheme (server) == U_UNKNOWN) {
strcpy (buf, "nntp://");
p = strchr (buf, '\0');
/* New newsserver */
serv = p_new(NNTP_SERVER, 1);
serv->conn = conn;
- serv->newsrc = str_dup (file);
+ serv->newsrc = m_strdup(file);
serv->newsgroups = hash_create (1009);
slurp_newsrc (serv); /* load .newsrc */
nntp_parse_cacheindex (serv); /* load .index */
line = *buf + (*pline - line);
}
strcpy (line, data->group);
- len -= str_len (line) + 1;
- line += str_len (line);
+ len -= m_strlen(line) + 1;
+ line += m_strlen(line);
*line++ = data->subscribed ? ':' : '!';
*line++ = ' ';
*line = '\0';
continue;
nntp_create_newsrc_line (data, &buf, &line, &llen);
debug_print (2, ("Added to newsrc: %s\n", line));
- line += str_len (line);
+ line += m_strlen(line);
}
/* newrc being fully rewritten */
if (news->newsrc &&
return fp;
nntp_cache_expand (buf, "cache-XXXXXX");
- pc = buf + str_len (buf) - 12; /* positioning to "cache-XXXXXX" */
+ pc = buf + m_strlen(buf) - 12; /* positioning to "cache-XXXXXX" */
if ((fd = mkstemp (buf)) == -1)
return NULL;
strcpy (s, pc); /* generated name */
else {
strfcpy (buf, news->conn->account.host, sizeof (buf));
f = mutt_mkname (buf);
- news->cache = str_dup (buf);
+ news->cache = m_strdup(buf);
nntp_cache_expand (file, buf);
}
if (!f)
((NNTP_DATA *) ctx->data)->nserv->conn->account.host,
((NNTP_DATA *) ctx->data)->group);
f = mutt_mkname (buf);
- ((NNTP_DATA *) ctx->data)->cache = str_dup (buf);
+ ((NNTP_DATA *) ctx->data)->cache = m_strdup(buf);
nntp_cache_expand (file, buf);
}
if (!f)
if (!news || !news->newsgroups || !group || !*group)
return NULL;
if (!(data = (NNTP_DATA *) hash_find (news->newsgroups, group))) {
- data = xmalloc(sizeof(NNTP_DATA) + str_len(group) + 1);
+ data = xmalloc(sizeof(NNTP_DATA) + m_strlen(group) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_crypt.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <unistd.h>
pos += chunk;
if (chunk >= sizeof (buf)) {
- lenbuf += str_len (p);
+ lenbuf += m_strlen(p);
}
else {
if (bar) {
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL &&
str_cmp (d, data->desc)) {
p_delete(&data->desc);
- data->desc = str_dup (d);
+ data->desc = m_strdup(d);
}
return 0;
#undef news
int x, done = 0;
hdr->env = mutt_new_envelope ();
- hdr->env->newsgroups = str_dup (nntp_data->group);
+ hdr->env->newsgroups = m_strdup(nntp_data->group);
hdr->content = mutt_new_body ();
hdr->content->type = TYPETEXT;
- hdr->content->subtype = str_dup ("plain");
+ hdr->content->subtype = m_strdup("plain");
hdr->content->encoding = ENC7BIT;
hdr->content->disposition = DISPINLINE;
hdr->content->length = -1;
nntp_get_status (ctx, hdr, NULL, hdr->article_num);
break;
case 1:
- hdr->env->subject = str_dup (b);
+ hdr->env->subject = m_strdup(b);
break;
case 2:
rfc822_free_address (&hdr->env->from);
* bothered me for _years_ */
if (!hdr->env->from) {
hdr->env->from = rfc822_new_address ();
- hdr->env->from->personal = str_dup (b);
+ hdr->env->from->personal = m_strdup(b);
}
break;
case 3:
break;
case 4:
p_delete(&hdr->env->message_id);
- hdr->env->message_id = str_dup (b);
+ hdr->env->message_id = m_strdup(b);
break;
case 5:
mutt_free_list (&hdr->env->references);
if (!hdr->read)
p_delete(&hdr->env->xref);
b = b + 6; /* skips the "Xref: " */
- hdr->env->xref = str_dup (b);
+ hdr->env->xref = m_strdup(b);
nntp_parse_xref (ctx, nntp_data->group, b, hdr);
}
rfc2047_decode_envelope (hdr->env);
/* create NNTP-specific state struct if nof found in list */
if ((nntp_data = (NNTP_DATA *) hash_find (serv->newsgroups, buf)) == NULL) {
- nntp_data = xmalloc(sizeof(NNTP_DATA) + str_len(buf) + 1);
+ nntp_data = xmalloc(sizeof(NNTP_DATA) + m_strlen(buf) + 1);
nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
strcpy (nntp_data->group, buf);
hash_insert (serv->newsgroups, nntp_data->group, nntp_data, 0);
cache->index = ctx->hdrs[msgno]->index;
mutt_mktemp (path);
- cache->path = str_dup (path);
+ cache->path = m_strdup(path);
if (!(msg->fp = safe_fopen (path, "w+"))) {
p_delete(&cache->path);
return -1;
buf[0] = '.';
buf[1] = '\0';
while (fgets (buf + 1, sizeof (buf) - 2, f) != NULL) {
- len = str_len (buf);
+ len = m_strlen(buf);
if (buf[len - 1] == '\n') {
buf[len - 1] = '\r';
buf[len] = '\n';
}
fclose (f);
- if (buf[str_len (buf) - 1] != '\n')
+ if (buf[m_strlen(buf) - 1] != '\n')
mutt_socket_write_d (nntp_data->nserv->conn, "\r\n", M_SOCK_LOG_HDR);
mutt_socket_write_d (nntp_data->nserv->conn, ".\r\n", M_SOCK_LOG_HDR);
if (mutt_socket_readln (buf, sizeof (buf), nntp_data->nserv->conn) < 0) {
return 0;
if ((nntp_data = (NNTP_DATA *) hash_find (s->newsgroups, group)) == NULL) {
n++;
- nntp_data = xmalloc(sizeof(NNTP_DATA) + str_len(group) + 1);
+ nntp_data = xmalloc(sizeof(NNTP_DATA) + m_strlen(group) + 1);
nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
strcpy (nntp_data->group, group);
nntp_data->nserv = s;
if (nntp_data->desc)
p_delete(&nntp_data->desc);
if (*desc)
- nntp_data->desc = str_dup (desc);
+ nntp_data->desc = m_strdup(desc);
if (nntp_data->rc || nntp_data->lastCached)
mutt_newsgroup_stat (nntp_data);
else if (nntp_data->lastMessage &&
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_crypt.h"
-#include "lib/str.h"
#include "lib/rx.h"
#include "lib/debug.h"
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_crypt.h"
#include "url.h"
-#include "lib/str.h"
#include "lib/rx.h"
#include "lib/debug.h"
return (line);
}
- buf += str_len (buf) - 1;
+ buf += m_strlen(buf) - 1;
if (*buf == '\n') {
/* we did get a full line. remove trailing space */
while (ISSPACE (*buf))
new = NULL;
if (*s == '<') {
- n = str_len (s);
+ n = m_strlen(s);
if (s[n - 1] != '>') {
o = s;
s = NULL;
continue;
}
- new = str_dup (s);
+ new = m_strdup(s);
}
else if (o) {
- m = str_len (s);
+ m = m_strlen(s);
if (s[m - 1] == '>') {
new = p_new(char, n + m + 1);
strcpy (new, o); /* __STRCPY_CHECKED__ */
buffer[i] = 0;
}
- new->value = str_dup (buffer);
+ new->value = m_strdup(buffer);
debug_print (2, ("`%s' = `%s'\n", new->attribute ? new->attribute : "",
new->value ? new->value : ""));
* let that take precedence, and don't set it here */
if ((pc = mutt_get_parameter ("name", ct->parameter)) != 0
&& !ct->filename)
- ct->filename = str_dup (pc);
+ ct->filename = m_strdup(pc);
#ifdef SUN_ATTACHMENT
/* this is deep and utter perversion */
*subtype++ = '\0';
for (pc = subtype; *pc && !ISSPACE (*pc) && *pc != ';'; pc++);
*pc = '\0';
- ct->subtype = str_dup (subtype);
+ ct->subtype = m_strdup(subtype);
}
/* Finally, get the major type */
#ifdef SUN_ATTACHMENT
if (ascii_strcasecmp ("x-sun-attachment", s) == 0)
- ct->subtype = str_dup ("x-sun-attachment");
+ ct->subtype = m_strdup("x-sun-attachment");
#endif
if (ct->type == TYPEOTHER) {
- ct->xtype = str_dup (s);
+ ct->xtype = m_strdup(s);
}
if (ct->subtype == NULL) {
* field, so we can attempt to convert the type to BODY here.
*/
if (ct->type == TYPETEXT)
- ct->subtype = str_dup ("plain");
+ ct->subtype = m_strdup("plain");
else if (ct->type == TYPEAUDIO)
- ct->subtype = str_dup ("basic");
+ ct->subtype = m_strdup("basic");
else if (ct->type == TYPEMESSAGE)
- ct->subtype = str_dup ("rfc822");
+ ct->subtype = m_strdup("rfc822");
else if (ct->type == TYPEOTHER) {
char buffer[SHORT_STRING];
ct->type = TYPEAPPLICATION;
snprintf (buffer, sizeof (buffer), "x-%s", s);
- ct->subtype = str_dup (buffer);
+ ct->subtype = m_strdup(buffer);
}
else
- ct->subtype = str_dup ("x-unknown");
+ ct->subtype = m_strdup("x-unknown");
}
/* Default character set for text types. */
(parms = parse_parameters (s)))) != 0)
str_replace (&ct->filename, s);
if ((s = mutt_get_parameter ("name", parms)) != 0)
- ct->form_name = str_dup (s);
+ ct->form_name = m_strdup(s);
mutt_free_parameter (&parms);
}
}
}
p->offset = ftello (fp); /* Mark the start of the real data */
if (p->type == TYPETEXT && !p->subtype)
- p->subtype = str_dup ("plain");
+ p->subtype = m_strdup("plain");
else if (p->type == TYPEMESSAGE && !p->subtype)
- p->subtype = str_dup ("rfc822");
+ p->subtype = m_strdup("rfc822");
p_delete(&line);
return (NULL);
}
- blen = str_len (boundary);
+ blen = m_strlen(boundary);
while (ftello (fp) < end_off && fgets (buffer, LONG_STRING, fp) != NULL) {
- len = str_len (buffer);
+ len = m_strlen(buffer);
crlf = (len > 1 && buffer[len - 2] == '\r') ? 1 : 0;
* bothered me for _years_ */
if (!e->from) {
e->from = rfc822_new_address ();
- e->from->personal = str_dup (p);
+ e->from->personal = m_strdup(p);
}
matched = 1;
}
else if (!str_casecmp (line + 1, "ollowup-to")) {
if (!e->followup_to) {
str_skip_trailws (p);
- e->followup_to = str_dup (str_skip_initws (p));
+ e->followup_to = m_strdup(str_skip_initws (p));
}
matched = 1;
}
if (!str_casecmp (line + 1, "ewsgroups")) {
p_delete(&e->newsgroups);
str_skip_trailws (p);
- e->newsgroups = str_dup (str_skip_initws (p));
+ e->newsgroups = m_strdup(str_skip_initws (p));
matched = 1;
}
break;
/* field `Organization:' saves only for pager! */
if (!str_casecmp (line + 1, "rganization")) {
if (!e->organization && str_casecmp (p, "unknown"))
- e->organization = str_dup (p);
+ e->organization = m_strdup(p);
}
break;
case 's':
if (!ascii_strcasecmp (line + 1, "ubject")) {
if (!e->subject)
- e->subject = str_dup (p);
+ e->subject = m_strdup(p);
matched = 1;
}
else if (!ascii_strcasecmp (line + 1, "ender")) {
}
else if ((!ascii_strcasecmp ("upersedes", line + 1) ||
!ascii_strcasecmp ("upercedes", line + 1)) && hdr)
- e->supersedes = str_dup (p);
+ e->supersedes = m_strdup(p);
break;
case 't':
matched = 1;
}
else if (ascii_strcasecmp (line + 1, "-label") == 0) {
- e->x_label = str_dup (p);
+ e->x_label = m_strdup(p);
matched = 1;
}
#ifdef USE_NNTP
else if (!str_casecmp (line + 1, "-comment-to")) {
if (!e->x_comment_to)
- e->x_comment_to = str_dup (p);
+ e->x_comment_to = m_strdup(p);
matched = 1;
}
else if (!str_casecmp (line + 1, "ref")) {
if (!e->xref)
- e->xref = str_dup (p);
+ e->xref = m_strdup(p);
matched = 1;
}
#endif
/* Keep track of the user-defined headers */
if (!matched && user_hdrs) {
/* restore the original line */
- line[str_len (line)] = ':';
+ line[m_strlen(line)] = ':';
if (weed && option (OPTWEED) && mutt_matches_ignore (line, Ignore)
&& !mutt_matches_ignore (line, UnIgnore))
}
else
last = e->userhdrs = mutt_new_list ();
- last->data = str_dup (line);
+ last->data = m_strdup(line);
if (do_2047)
rfc2047_decode (&last->data);
}
/* set the defaults from RFC1521 */
hdr->content->type = TYPETEXT;
- hdr->content->subtype = str_dup ("plain");
+ hdr->content->subtype = m_strdup("plain");
hdr->content->encoding = ENC7BIT;
hdr->content->length = -1;
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "copy.h"
#include "mime.h"
-#include "lib/str.h"
#ifdef USE_IMAP
#include "mx.h"
match = 1;
break;
}
- lng -= str_len (buf);
+ lng -= m_strlen(buf);
}
p_delete(&buf);
#endif
if (pat->stringmatch) {
- pat->str = str_dup (buf.data);
+ pat->str = m_strdup(buf.data);
p_delete(&buf.data);
} else {
pat->rx = p_new(regex_t, 1);
memset (&ps, 0, sizeof (ps));
ps.dptr = s;
- ps.dsize = str_len (s);
+ ps.dsize = m_strlen(s);
while (*ps.dptr) {
SKIPWS (ps.dptr);
mutt_message _("Compiling search pattern...");
- simple = str_dup (buf);
+ simple = m_strdup(buf);
mutt_check_simple (buf, sizeof (buf), NONULL (SimpleSearch));
err.data = error;
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "copy.h"
#include "attach.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <sys/wait.h>
break;
offset = ftello (s->fpin);
- bytes -= (offset - last_pos); /* don't rely on str_len(buf) */
+ bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */
last_pos = offset;
if (str_ncmp ("-----BEGIN PGP ", buf, 15) == 0) {
fputs (buf, tmpfp);
while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) {
offset = ftello (s->fpin);
- bytes -= (offset - last_pos); /* don't rely on str_len(buf) */
+ bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */
last_pos = offset;
fputs (buf, tmpfp);
* read_mime_header has a hard time parsing the message.
*/
while (fgets (buf, sizeof (buf) - 1, pgpout) != NULL) {
- len = str_len (buf);
+ len = m_strlen(buf);
if (len > 1 && buf[len - 2] == '\r')
strcpy (buf + len - 2, "\n"); /* __STRCPY_CHECKED__ */
fputs (buf, fpout);
t = mutt_new_body ();
t->type = TYPEMULTIPART;
- t->subtype = str_dup ("signed");
+ t->subtype = m_strdup("signed");
t->encoding = ENC7BIT;
t->use_disp = 0;
t->disposition = DISPINLINE;
t->parts->next = mutt_new_body ();
t = t->parts->next;
t->type = TYPEAPPLICATION;
- t->subtype = str_dup ("pgp-signature");
- t->filename = str_dup (sigfile);
+ t->subtype = m_strdup("pgp-signature");
+ t->filename = m_strdup(sigfile);
t->use_disp = 0;
t->disposition = DISPINLINE;
t->encoding = ENC7BIT;
/* or should we require the "0x"? */
if (strncmp (s, "0x", 2) == 0)
s += 2;
- if (str_len (s) % 8)
+ if (m_strlen(s) % 8)
return 0;
while (*s)
if (strchr ("0123456789ABCDEFabcdef", *s++) == NULL)
keyID = pgp_keyid (key);
bypass_selection:
- keylist_size += str_len (keyID) + 4;
+ keylist_size += m_strlen(keyID) + 4;
p_realloc(&keylist, keylist_size);
sprintf (keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", /* __SPRINTF_CHECKED__ */
keyID);
- keylist_used = str_len (keylist);
+ keylist_used = m_strlen(keylist);
pgp_free_key (&key);
rfc822_free_address (&addr);
t = mutt_new_body ();
t->type = TYPEMULTIPART;
- t->subtype = str_dup ("encrypted");
+ t->subtype = m_strdup("encrypted");
t->encoding = ENC7BIT;
t->use_disp = 0;
t->disposition = DISPINLINE;
t->parts = mutt_new_body ();
t->parts->type = TYPEAPPLICATION;
- t->parts->subtype = str_dup ("pgp-encrypted");
+ t->parts->subtype = m_strdup("pgp-encrypted");
t->parts->encoding = ENC7BIT;
t->parts->next = mutt_new_body ();
t->parts->next->type = TYPEAPPLICATION;
- t->parts->next->subtype = str_dup ("octet-stream");
+ t->parts->next->subtype = m_strdup("octet-stream");
t->parts->next->encoding = ENC7BIT;
- t->parts->next->filename = str_dup (tempfile);
+ t->parts->next->filename = m_strdup(tempfile);
t->parts->next->use_disp = 1;
t->parts->next->disposition = DISPINLINE;
t->parts->next->unlink = 1; /* delete after sending the message */
- t->parts->next->d_filename = str_dup ("msg.asc"); /* non pgp/mime can save */
+ t->parts->next->d_filename = m_strdup("msg.asc"); /* non pgp/mime can save */
return (t);
}
b->encoding = ENC7BIT;
b->type = TYPETEXT;
- b->subtype = str_dup ("plain");
+ b->subtype = m_strdup("plain");
mutt_set_parameter ("x-action",
flags & ENCRYPT ? "pgp-encrypted" : "pgp-signed",
&b->parameter);
mutt_set_parameter ("charset", send_charset, &b->parameter);
- b->filename = str_dup (pgpoutfile);
+ b->filename = m_strdup(pgpoutfile);
#if 0
/* The following is intended to give a clue to some completely brain-dead
* "mail environments" which are typically used by large corporations.
*/
- b->d_filename = str_dup ("msg.pgp");
+ b->d_filename = m_strdup("msg.pgp");
b->use_disp = 1;
#endif
#include <time.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "pgp.h"
#include "rfc822.h"
-#include "lib/str.h"
#include "lib/debug.h"
/*
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "pager.h"
#include "sort.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <string.h>
l = p_new(struct pgp_cache, 1);
l->next = id_defaults;
id_defaults = l;
- l->what = str_dup (whatfor);
- l->dflt = str_dup (resp);
+ l->what = m_strdup(whatfor);
+ l->dflt = m_strdup(resp);
}
}
fclose (devnull);
att = mutt_new_body ();
- att->filename = str_dup (tempf);
+ att->filename = m_strdup(tempf);
att->unlink = 1;
att->use_disp = 0;
att->type = TYPEAPPLICATION;
- att->subtype = str_dup ("pgp-keys");
+ att->subtype = m_strdup("pgp-keys");
snprintf (buff, sizeof (buff), _("PGP Key %s."), tmp);
- att->description = str_dup (buff);
+ att->description = m_strdup(buff);
mutt_update_encoding (att);
stat (tempf, &sb);
char *scratch;
char *t;
- if ((scratch = str_dup (str)) == NULL)
+ if ((scratch = m_strdup(str)) == NULL)
return hints;
for (t = strtok (scratch, " ,.:\"()<>\n"); t;
t = strtok (NULL, " ,.:\"()<>\n")) {
- if (str_len (t) > 3)
+ if (m_strlen(t) > 3)
hints = mutt_add_list (hints, t);
}
*lp = p_new(pgp_uid_t, 1);
(*lp)->trust = up->trust;
(*lp)->flags = up->flags;
- (*lp)->addr = str_dup (up->addr);
+ (*lp)->addr = m_strdup(up->addr);
(*lp)->parent = parent;
lp = &(*lp)->next;
}
return;
}
- if ((end = ftello (in) - str_len (line)) < start) {
+ if ((end = ftello (in) - m_strlen(line)) < start) {
debug_print (1, ("end < start???\n"));
return;
}
#endif
#include <lib-lib/mem.h>
-
-#include "lib/str.h"
+#include <lib-lib/str.h>
#include <stdio.h>
#include <stdlib.h>
"%08lX", id);
}
- p->keyid = str_dup ((char *) scratch);
+ p->keyid = m_strdup((char *) scratch);
return p;
id);
}
- p->keyid = str_dup ((char *) scratch);
+ p->keyid = m_strdup((char *) scratch);
return p;
}
char *error_buf;
size_t error_buf_len;
- error_buf_len = sizeof ("fopen: ") - 1 + str_len (ringfile) + 1;
+ error_buf_len = sizeof ("fopen: ") - 1 + m_strlen(ringfile) + 1;
error_buf = p_new(char, error_buf_len);
snprintf (error_buf, error_buf_len, "fopen: %s", ringfile);
perror (error_buf);
#include <sys/stat.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "mutt.h"
#include "pop.h"
#include "mx.h"
#include "mx_pop.h"
-#include "lib/str.h"
#include "url.h"
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_crypt.h"
#include "mutt_curses.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <string.h>
ctx->msgcount++;
ctx->hdrs[i] = mutt_new_header ();
- ctx->hdrs[i]->data = str_dup (line);
+ ctx->hdrs[i]->data = m_strdup(line);
}
else if (ctx->hdrs[i]->index != index - 1)
pop_data->clear_cache = 1;
return -1;
p_delete(&ctx->path);
- ctx->path = str_dup (buf);
+ ctx->path = m_strdup(buf);
pop_data = p_new(POP_DATA, 1);
pop_data->conn = conn;
* portion of the headers, those required for the main display.
*/
cache->index = h->index;
- cache->path = str_dup (path);
+ cache->path = m_strdup(path);
rewind (msg->fp);
uidl = h->data;
mutt_free_envelope (&h->env);
if ((p1 = strchr (buf, '<')) && (p2 = strchr (p1, '>'))) {
p2[1] = '\0';
- pop_data->timestamp = str_dup (p1);
+ pop_data->timestamp = m_strdup(p1);
}
}
if (PopAuthenticators && *PopAuthenticators) {
/* Try user-specified list of authentication methods */
- methods = str_dup (PopAuthenticators);
+ methods = m_strdup(PopAuthenticators);
method = methods;
while (method) {
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#endif
#include "lib/debug.h"
-#include "lib/str.h"
#include <string.h>
#include <unistd.h>
acct->port = POP_PORT;
acct->type = M_ACCT_TYPE_POP;
- c = str_dup (path);
+ c = m_strdup(path);
url_parse_ciss (&url, c);
if (url.scheme == U_POP || url.scheme == U_POPS) {
p_delete(&pop_data->auth_list);
c = line + 4;
SKIPWS (c);
- pop_data->auth_list = str_dup (c);
+ pop_data->auth_list = m_strdup(c);
}
else if (!ascii_strncasecmp (line, "STLS", 4))
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#endif
#include "mutt_crypt.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <ctype.h>
file[0] = '\0';
if (b->filename) {
strfcpy (file, b->filename, sizeof (file));
- b->d_filename = str_dup (b->filename);
+ b->d_filename = m_strdup(b->filename);
}
else {
/* avoid Content-Disposition: header with temporary filename */
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mapping.h"
#include "sort.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <string.h>
tmp = rfc822_cpy_adr (r->addr);
if (!tmp->next && !tmp->personal)
- tmp->personal = str_dup (r->name);
+ tmp->personal = m_strdup(r->name);
mutt_addrlist_to_idna (tmp, NULL);
return tmp;
l = mutt_strwidth (p);
if (l > FirstColumn)
FirstColumn = l;
- cur->name = str_dup (p);
+ cur->name = m_strdup(p);
p = strtok (NULL, "\t\n");
if (p) {
- cur->other = str_dup (p);
+ cur->other = m_strdup(p);
}
}
}
mutt_format_string (buf2, sizeof (buf2),
FirstColumn + 2, FirstColumn + 2,
0, ' ', table[num].data->name,
- str_len (table[num].data->name), 0);
+ m_strlen(table[num].data->name), 0);
snprintf (s, slen, " %c %3d %s %-*.*s %s",
table[num].tagged ? '*' : ' ',
mutt_addrlist_to_local (tmpa);
tagged = 1;
rfc822_write_address (buf, buflen, tmpa, 0);
- curpos = str_len (buf);
+ curpos = m_strlen(buf);
rfc822_free_address (&tmpa);
}
else if (curpos + 2 < buflen) {
strcat (buf, ", "); /* __STRCAT_CHECKED__ */
rfc822_write_address ((char *) buf + curpos + 1,
buflen - curpos - 1, tmpa, 0);
- curpos = str_len (buf);
+ curpos = m_strlen(buf);
rfc822_free_address (&tmpa);
}
}
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "copy.h"
#include "mutt_crypt.h"
-#include "lib/str.h"
#include <ctype.h>
#include <stdlib.h>
str_replace (&idx[x]->tree, buf);
}
else
- idx[x]->tree = str_dup (buf);
+ idx[x]->tree = m_strdup(buf);
if (2 * (idx[x]->level + 2) < sizeof (buf) && idx[x]->level) {
s = buf + 2 * (idx[x]->level - 1);
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "copy.h"
#include "mutt_idna.h"
-#include "lib/str.h"
/* some helper functions to verify that we are exclusively operating
* on message/rfc822 attachments
/* in case followup set Newsgroups: with Followup-To: if it present */
if (!env->newsgroups && curenv &&
str_casecmp (curenv->followup_to, "poster"))
- env->newsgroups = str_dup (curenv->followup_to);
+ env->newsgroups = m_strdup(curenv->followup_to);
}
else
#endif
#include "lisp.h"
#include "buffer.h"
#include "syntax.h"
-#include "lib/str.h"
+#include <lib-lib/str.h>
#else /* not emacs */
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "remailer.h"
-#include "lib/str.h"
#include "lib/rx.h"
#include <stdio.h>
/* first, generate the "random" remailer */
p = mix_new_remailer ();
- p->shortname = str_dup ("<random>");
+ p->shortname = m_strdup("<random>");
mix_add_entry (&type2_list, p, &slots, &used);
while (fgets (line, sizeof (line), fp)) {
if (!(t = strtok (line, " \t\n")))
goto problem;
- p->shortname = str_dup (t);
+ p->shortname = m_strdup(t);
if (!(t = strtok (NULL, " \t\n")))
goto problem;
- p->addr = str_dup (t);
+ p->addr = m_strdup(t);
if (!(t = strtok (NULL, " \t\n")))
goto problem;
if (!(t = strtok (NULL, " \t\n")))
goto problem;
- p->ver = str_dup (t);
+ p->ver = m_strdup(t);
if (!(t = strtok (NULL, " \t\n")))
goto problem;
if (i) {
c =
- coords[i - 1].c + str_len (type2_list[chain->ch[i - 1]]->shortname) + 2;
+ coords[i - 1].c + m_strlen(type2_list[chain->ch[i - 1]]->shortname) + 2;
r = coords[i - 1].r;
}
else {
for (; i < chain->cl; i++) {
oc = c;
- c += str_len (type2_list[chain->ch[i]]->shortname) + 2;
+ c += m_strlen(type2_list[chain->ch[i]]->shortname) + 2;
if (c >= COLS) {
oc = c = MIX_HOFFSET;
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "rfc1524.h"
#include "attach.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <string.h>
field = ch;
ch = get_field (ch);
if (entry)
- entry->command = str_dup (field);
+ entry->command = m_strdup(field);
/* parse the optional fields */
found = TRUE;
if (get_field_text (field + 4, &test_command, type, filename, line)
&& test_command) {
- len = str_len (test_command) + STRING;
+ len = m_strlen(test_command) + STRING;
p_realloc(&test_command, len);
rfc1524_expand_command (a, a->filename, type, test_command, len);
if (mutt_system (test_command)) {
rmatch = 1;
- for (r = 0, j = str_len (oldfile) - 1, k =
- str_len (nametemplate) - 1;
+ for (r = 0, j = m_strlen(oldfile) - 1, k =
+ m_strlen(nametemplate) - 1;
j >= (lmatch ? i : 0) && k >= i + 2; j--, k--) {
if (nametemplate[k] != oldfile[j]) {
rmatch = 0;
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "mutt.h"
#include "ascii.h"
#include "rfc2047.h"
#include "thread.h"
-#include "lib/str.h"
#include <ctype.h>
#include <errno.h>
#endif
#define ENCWORD_LEN_MAX 75
-#define ENCWORD_LEN_MIN 9 /* str_len ("=?.?.?.?=") */
+#define ENCWORD_LEN_MIN 9 /* m_strlen("=?.?.?.?=") */
#define HSPACE(x) ((x) == '\0' || (x) == ' ' || (x) == '\t')
q = strchr (p, ':');
- n = q ? q - p : str_len (p);
+ n = q ? q - p : m_strlen(p);
if (!n ||
/* Assume that we never need more than 12 characters of
char *s0 = s;
memcpy (s, "=?", 2), s += 2;
- memcpy (s, tocode, str_len (tocode)), s += str_len (tocode);
+ memcpy (s, tocode, m_strlen(tocode)), s += m_strlen(tocode);
memcpy (s, "?B?", 3), s += 3;
for (;;) {
if (!dlen)
char *s0 = s;
memcpy (s, "=?", 2), s += 2;
- memcpy (s, tocode, str_len (tocode)), s += str_len (tocode);
+ memcpy (s, tocode, m_strlen(tocode)), s += m_strlen(tocode);
memcpy (s, "?Q?", 3), s += 3;
while (dlen--) {
unsigned char c = *d++;
if (fromcode) {
cd = mutt_iconv_open (tocode, fromcode, 0);
assert (cd != (iconv_t) (-1));
- ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - str_len (tocode);
+ ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - m_strlen(tocode);
if (my_iconv(cd, &ib, &ibl, &ob, &obl) == (size_t) (-1) ||
my_iconv(cd, 0, 0, &ob, &obl) == (size_t) (-1)) {
assert (errno == E2BIG);
iconv_close (cd);
}
else {
- if (dlen > sizeof (buf1) - str_len (tocode))
- return sizeof (buf1) - str_len (tocode) + 1;
+ if (dlen > sizeof (buf1) - m_strlen(tocode))
+ return sizeof (buf1) - m_strlen(tocode) + 1;
memcpy (buf1, d, dlen);
ob = buf1 + dlen;
}
++count;
}
- len = ENCWORD_LEN_MIN - 2 + str_len (tocode);
+ len = ENCWORD_LEN_MIN - 2 + m_strlen(tocode);
len_b = len + (((ob - buf1) + 2) / 3) * 4;
len_q = len + (ob - buf1) + 2 * count;
if (fromcode) {
cd = mutt_iconv_open (tocode, fromcode, 0);
assert (cd != (iconv_t) (-1));
- ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - str_len (tocode);
+ ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - m_strlen(tocode);
n1 = my_iconv(cd, &ib, &ibl, &ob, &obl);
n2 = my_iconv(cd, 0, 0, &ob, &obl);
assert (n1 != (size_t) (-1) && n2 != (size_t) (-1));
/* Add to output buffer. */
#define LINEBREAK "\n\t"
- if (bufpos + wlen + str_len (LINEBREAK) > buflen) {
- buflen = bufpos + wlen + str_len (LINEBREAK);
+ if (bufpos + wlen + m_strlen(LINEBREAK) > buflen) {
+ buflen = bufpos + wlen + m_strlen(LINEBREAK);
p_realloc(&buf, buflen);
}
r = encode_block (buf + bufpos, t, n, icode, tocode, encoder);
assert (r == wlen);
bufpos += wlen;
- memcpy (buf + bufpos, LINEBREAK, str_len (LINEBREAK));
- bufpos += str_len (LINEBREAK);
+ memcpy (buf + bufpos, LINEBREAK, m_strlen(LINEBREAK));
+ bufpos += m_strlen(LINEBREAK);
#undef LINEBREAK
col = 1;
if (!charsets || !*charsets)
charsets = "UTF-8";
- rfc2047_encode (*pd, str_len (*pd), col,
+ rfc2047_encode (*pd, m_strlen(*pd), col,
Charset, charsets, &e, &elen,
encode_specials ? RFC822Specials : NULL);
void rfc2047_encode_adrlist (ADDRESS * addr, const char *tag)
{
ADDRESS *ptr = addr;
- int col = tag ? str_len (tag) + 2 : 32;
+ int col = tag ? m_strlen(tag) + 2 : 32;
while (ptr) {
if (ptr->personal)
int enc = 0, count = 0;
char *charset = NULL;
- pd = d0 = p_new(char, str_len(s));
+ pd = d0 = p_new(char, m_strlen(s));
for (pp = s; (pp1 = strchr (pp, '?')); pp = pp1 + 1) {
count++;
if (!s || !*s)
return;
- dlen = 4 * str_len (s); /* should be enough */
+ dlen = 4 * m_strlen(s); /* should be enough */
d = d0 = p_new(char, dlen + 1);
while (*s && dlen > 0) {
if (!(p = find_encoded_word (s, &q))) {
/* no encoded words */
if (!option (OPTSTRICTMIME)) {
- n = str_len (s);
+ n = m_strlen(s);
if (found_encoded && (m = lwslen (s, n)) != 0) {
if (m != n)
*d = ' ', d++, dlen--;
t = p_dupstr(s, n);
if (mutt_convert_nonmime_string (&t) == 0) {
- tlen = str_len (t);
+ tlen = m_strlen(t);
strncpy (d, t, tlen);
d += tlen;
}
rfc2047_decode_word (d, p, dlen);
found_encoded = 1;
s = q;
- n = str_len (d);
+ n = m_strlen(d);
dlen -= n;
d += n;
}
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "mutt.h"
#include "ascii.h"
#include "mime.h"
#include "charset.h"
-#include "lib/str.h"
#include "rfc2047.h"
#include "rfc2231.h"
if (encoded && par->encoded)
rfc2231_decode_one (par->value, valp);
- vl = str_len (par->value);
+ vl = m_strlen(par->value);
p_realloc(&value, l + vl + 1);
strcpy (value + l, par->value); /* __STRCPY_CHECKED__ */
if (encoded)
mutt_convert_string (&value, charset, Charset, M_ICONV_HOOK_FROM);
*head = mutt_new_parameter ();
- (*head)->attribute = str_dup (attribute);
+ (*head)->attribute = m_strdup(attribute);
(*head)->value = value;
head = &(*head)->next;
}
if (!Charset || !SendCharset ||
!(charset = mutt_choose_charset (Charset, SendCharset,
- *pd, str_len (*pd), &d, &dlen))) {
- charset = str_dup (Charset ? Charset : "unknown-8bit");
+ *pd, m_strlen(*pd), &d, &dlen))) {
+ charset = m_strdup(Charset ? Charset : "unknown-8bit");
d = *pd;
- dlen = str_len (d);
+ dlen = m_strlen(d);
}
if (!mutt_is_us_ascii (charset))
++ext;
if (encode) {
- e = p_new(char, dlen + 2 * ext + str_len(charset) + 3);
+ e = p_new(char, dlen + 2 * ext + m_strlen(charset) + 3);
sprintf (e, "%s''", charset); /* __SPRINTF_CHECKED__ */
- t = e + str_len (e);
+ t = e + m_strlen(e);
for (s = d, slen = dlen; slen; s++, slen--)
if (*s < 0x20 || *s >= 0x7f ||
strchr (MimeSpecials, *s) || strchr ("*'%", *s)) {
#include <sys/stat.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "state.h"
#include "lib.h"
-#include "lib/str.h"
#include "lib/debug.h"
#define FLOWED_MAX 77
static void print_flowed_line (char *line, STATE * s, int ql) {
int width;
char *pos, *oldpos;
- int len = str_len (line);
+ int len = m_strlen(line);
int i;
if (MaxLineLength > 0) {
width = COLS;
}
- if (str_len (line) == 0) {
+ if (m_strlen(line) == 0) {
if (!(s->flags & M_REPLYING) || option (OPTQUOTEEMPTY)) {
if (s->prefix)
state_puts(s->prefix,s);
/* respect DelSP of RfC3676 only with f=f parts */
if ((t = (char*) mutt_get_parameter ("delsp", a->parameter))) {
- delsp = str_len (t) == 3 && ascii_strncasecmp (t, "yes", 3) == 0;
+ delsp = m_strlen(t) == 3 && ascii_strncasecmp (t, "yes", 3) == 0;
t = NULL;
}
while (bytes > 0 && fgets (buf, sizeof (buf), s->fpin)) {
- buf_len = str_len (buf);
+ buf_len = m_strlen(buf);
bytes -= buf_len;
newql = get_quote_level (buf);
fputc (' ', out);
#if DEBUG
lc++;
- len = str_len (buf);
+ len = m_strlen(buf);
if (len > 0) {
c = buf[len-1];
buf[len-1] = '\0';
#include <stdlib.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "ascii.h"
#include "mutt_idna.h"
-#include "lib/str.h"
#define terminate_string(a, b, c) do { if ((b) < (c)) a[(b)] = 0; else \
a[(c)] = 0; } while (0)
}
terminate_string (token, *tokenlen, tokenmax);
- addr->mailbox = str_dup (token);
+ addr->mailbox = m_strdup(token);
if (*commentlen && !addr->personal) {
terminate_string (comment, *commentlen, commentmax);
- addr->personal = str_dup (comment);
+ addr->personal = m_strdup(comment);
}
return s;
}
if (!addr->mailbox)
- addr->mailbox = str_dup ("@");
+ addr->mailbox = m_strdup("@");
s++;
return s;
}
else if (commentlen && last && !last->personal) {
terminate_buffer (comment, commentlen);
- last->personal = str_dup (comment);
+ last->personal = m_strdup(comment);
}
commentlen = 0;
else if (*s == ':') {
cur = rfc822_new_address ();
terminate_buffer (phrase, phraselen);
- cur->mailbox = str_dup (phrase);
+ cur->mailbox = m_strdup(phrase);
cur->group = 1;
if (last)
}
else if (commentlen && last && !last->personal) {
terminate_buffer (comment, commentlen);
- last->personal = str_dup (comment);
+ last->personal = m_strdup(comment);
}
/* add group terminator */
p_delete(&cur->personal);
/* if we get something like "Michael R. Elkins" remove the quotes */
rfc822_dequote_comment (phrase);
- cur->personal = str_dup (phrase);
+ cur->personal = m_strdup(phrase);
}
if ((ps =
parse_route_addr (s + 1, comment, &commentlen,
}
else if (commentlen && last && !last->personal) {
terminate_buffer (comment, commentlen);
- last->personal = str_dup (comment);
+ last->personal = m_strdup(comment);
}
return top;
for (; addr; addr = addr->next)
if (!addr->group && addr->mailbox && strchr (addr->mailbox, '@') == NULL) {
- p = p_new(char, str_len(addr->mailbox) + str_len(host) + 2);
+ p = p_new(char, m_strlen(addr->mailbox) + m_strlen(host) + 2);
sprintf (p, "%s@%s", addr->mailbox, host); /* __SPRINTF_CHECKED__ */
p_delete(&addr->mailbox);
addr->mailbox = p;
if (!buflen)
goto done;
strfcpy (pbuf, addr->personal, buflen);
- len = str_len (pbuf);
+ len = m_strlen(pbuf);
pbuf += len;
buflen -= len;
}
goto done;
if (ascii_strcmp (addr->mailbox, "@") && !display) {
strfcpy (pbuf, addr->mailbox, buflen);
- len = str_len (pbuf);
+ len = m_strlen(pbuf);
}
else if (ascii_strcmp (addr->mailbox, "@") && display) {
strfcpy (pbuf, mutt_addr_for_display (addr), buflen);
- len = str_len (pbuf);
+ len = m_strlen(pbuf);
}
else {
*pbuf = '\0';
int display)
{
char *pbuf = buf;
- size_t len = str_len (buf);
+ size_t len = m_strlen(buf);
buflen--; /* save room for the terminal nul */
/* this should be safe since we always have at least 1 char passed into
the above call, which means `pbuf' should always be nul terminated */
- len = str_len (pbuf);
+ len = m_strlen(pbuf);
pbuf += len;
buflen -= len;
{
ADDRESS *p = rfc822_new_address ();
- p->personal = str_dup (addr->personal);
- p->mailbox = str_dup (addr->mailbox);
+ p->personal = m_strdup(addr->personal);
+ p->mailbox = m_strdup(addr->mailbox);
p->group = addr->group;
return p;
}
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "url.h"
#include "attach.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <ctype.h>
if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) != 0)
return (-1);
p_delete(&en->newsgroups);
- en->newsgroups = str_dup (buf);
+ en->newsgroups = m_strdup(buf);
if (en->followup_to)
strfcpy (buf, en->followup_to, sizeof (buf));
&& mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) != 0)
return (-1);
p_delete(&en->followup_to);
- en->followup_to = str_dup (buf);
+ en->followup_to = m_strdup(buf);
if (en->x_comment_to)
strfcpy (buf, en->x_comment_to, sizeof (buf));
&& mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) != 0)
return (-1);
p_delete(&en->x_comment_to);
- en->x_comment_to = str_dup (buf);
+ en->x_comment_to = m_strdup(buf);
}
else
#endif
char *nntp_get_header (const char *s)
{
SKIPWS (s);
- return str_dup (s);
+ return m_strdup(s);
}
#endif
}
else
last = env->userhdrs = mutt_new_list ();
- last->data = str_dup (uh->data);
+ last->data = m_strdup(uh->data);
}
}
}
if (e->message_id) {
t = mutt_new_list ();
- t->data = str_dup (e->message_id);
+ t->data = m_strdup(e->message_id);
t->next = l;
l = t;
}
*/
if (curenv->real_subj) {
p_delete(&env->subject);
- env->subject = p_new(char, str_len(curenv->real_subj) + 5);
+ env->subject = p_new(char, m_strlen(curenv->real_subj) + 5);
sprintf (env->subject, "Re: %s", curenv->real_subj); /* __SPRINTF_CHECKED__ */
}
else if (!env->subject)
- env->subject = str_dup ("Re: your mail");
+ env->subject = m_strdup("Re: your mail");
#ifdef USE_NNTP
if (option (OPTNEWSSEND) && option (OPTXCOMMENTTO) && curenv->from)
- env->x_comment_to = str_dup (mutt_get_name (curenv->from));
+ env->x_comment_to = m_strdup(mutt_get_name (curenv->from));
#endif
}
if (curenv->message_id) {
*q = mutt_new_list ();
- (*q)->data = str_dup (curenv->message_id);
+ (*q)->data = m_strdup(curenv->message_id);
}
if (pp)
/* in case followup set Newsgroups: with Followup-To: if it present */
if (!env->newsgroups && curenv &&
str_casecmp (curenv->followup_to, "poster"))
- env->newsgroups = str_dup (curenv->followup_to);
+ env->newsgroups = m_strdup(curenv->followup_to);
}
else
#endif
#ifdef USE_NNTP
if (option (OPTNEWSSEND)) {
if (!e->followup_to && e->newsgroups && (strrchr (e->newsgroups, ',')))
- e->followup_to = str_dup (e->newsgroups);
+ e->followup_to = m_strdup(e->newsgroups);
return;
}
#endif
if (!option (OPTREVREAL))
p_delete(&tmp->personal);
if (!tmp->personal)
- tmp->personal = str_dup (Realname);
+ tmp->personal = m_strdup(Realname);
}
return (tmp);
}
adr = rfc822_cpy_adr_real (From);
else if (option (OPTUSEDOMAIN)) {
adr = rfc822_new_address ();
- adr->mailbox = p_new(char, str_len(Username) + str_len(fqdn) + 2);
+ adr->mailbox = p_new(char, m_strlen(Username) + m_strlen(fqdn) + 2);
sprintf (adr->mailbox, "%s@%s", NONULL (Username), NONULL (fqdn)); /* __SPRINTF_CHECKED__ */
}
else {
adr = rfc822_new_address ();
- adr->mailbox = str_dup (NONULL (Username));
+ adr->mailbox = m_strdup(NONULL (Username));
}
return (adr);
if ((WithCrypto & APPLICATION_PGP) && (flags & SENDPOSTPONED))
- signas = str_dup (PgpSignAs);
+ signas = m_strdup(PgpSignAs);
/* Delay expansion of aliases until absolutely necessary--shouldn't
* be necessary unless we are prompting the user or about to execute a
pbody->next = msg->content; /* don't kill command-line attachments */
msg->content = pbody;
- if (!(ctype = str_dup (ContentType)))
- ctype = str_dup ("text/plain");
+ if (!(ctype = m_strdup(ContentType)))
+ ctype = m_strdup("text/plain");
mutt_parse_content_type (ctype, msg->content);
p_delete(&ctype);
if (!tempfile) {
mutt_mktemp (buffer);
tempfp = safe_fopen (buffer, "w+");
- msg->content->filename = str_dup (buffer);
+ msg->content->filename = m_strdup(buffer);
}
else {
tempfp = safe_fopen (tempfile, "a+");
- msg->content->filename = str_dup (tempfile);
+ msg->content->filename = m_strdup(tempfile);
}
if (!tempfp) {
#ifdef USE_NNTP
if ((flags & SENDNEWS) && ctx && ctx->magic == M_NNTP
&& !msg->env->newsgroups)
- msg->env->newsgroups = str_dup (((NNTP_DATA *) ctx->data)->group);
+ msg->env->newsgroups = m_strdup(((NNTP_DATA *) ctx->data)->group);
#endif
if (!(flags & SENDMAILX) &&
that $realname can be set in a send-hook */
if (msg->env->from && !msg->env->from->personal
&& !(flags & (SENDRESEND | SENDPOSTPONED)))
- msg->env->from->personal = str_dup (Realname);
+ msg->env->from->personal = m_strdup(Realname);
if (!((WithCrypto & APPLICATION_PGP) && (flags & SENDKEY)))
safe_fclose (&tempfp);
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mutt_crypt.h"
#include "mutt_idna.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <string.h>
fprintf (f, "Content-Type: %s/%s", TYPE (a), a->subtype);
if (a->parameter) {
- len = 25 + str_len (a->subtype); /* approximate len. of content-type */
+ len = 25 + m_strlen(a->subtype); /* approximate len. of content-type */
for (p = a->parameter; p; p = p->next) {
char *tmp;
fputc (';', f);
buffer[0] = 0;
- tmp = str_dup (p->value);
+ tmp = m_strdup(p->value);
encode = rfc2231_encode_string (&tmp);
rfc822_cat (buffer, sizeof (buffer), tmp, MimeSpecials);
p_delete(&tmp);
- tmplen = str_len (buffer) + str_len (p->attribute) + 1;
+ tmplen = m_strlen(buffer) + m_strlen(p->attribute) + 1;
if (len + tmplen + 2 > 76) {
fputs ("\n\t", f);
t = fn;
buffer[0] = 0;
- tmp = str_dup (t);
+ tmp = m_strdup(t);
encode = rfc2231_encode_string (&tmp);
rfc822_cat (buffer, sizeof (buffer), tmp, MimeSpecials);
p_delete(&tmp);
type = TYPEOTHER;
cur_sze = 0;
- szf = str_len (path);
+ szf = m_strlen(path);
for (count = 0; count < 4; count++) {
/*
/* cycle through the file extensions */
while ((p = strtok (p, " \t\n"))) {
- sze = str_len (p);
+ sze = m_strlen(p);
if ((sze > cur_sze) && (szf >= sze) &&
(str_casecmp (path + szf - sze, p) == 0
|| ascii_strcasecmp (path + szf - sze, p) == 0) && (szf == sze
a->d_filename = a->filename;
if (a->filename && a->unlink)
unlink (a->filename);
- a->filename = str_dup (temp);
+ a->filename = m_strdup(temp);
a->unlink = 1;
if (stat (a->filename, &sb) == -1) {
mutt_perror ("stat");
mutt_decode_attachment (a, &s);
fclose (s.fpout);
a->d_filename = a->filename;
- a->filename = str_dup (buff);
+ a->filename = m_strdup(buff);
a->unlink = 1;
if (stat (a->filename, &sb) == -1) {
mutt_perror ("stat");
body = mutt_new_body ();
body->type = TYPEMESSAGE;
- body->subtype = str_dup ("rfc822");
- body->filename = str_dup (buffer);
+ body->subtype = m_strdup("rfc822");
+ body->filename = m_strdup(buffer);
body->unlink = 1;
body->use_disp = 0;
body->disposition = DISPINLINE;
CONTENT *info;
att = mutt_new_body ();
- att->filename = str_dup (path);
+ att->filename = m_strdup(path);
/* Attempt to determine the appropriate content-type based on the filename
* suffix.
mutt_lookup_mime_type (buf, sizeof (buf), xbuf, sizeof (xbuf),
path)) != TYPEOTHER || *xbuf != '\0') {
att->type = n;
- att->subtype = str_dup (buf);
- att->xtype = str_dup (xbuf);
+ att->subtype = m_strdup(buf);
+ att->xtype = m_strdup(xbuf);
}
#else
* chars if this is really a binary file...
*/
att->type = TYPETEXT;
- att->subtype = str_dup ("plain");
+ att->subtype = m_strdup("plain");
}
else {
att->type = TYPEAPPLICATION;
- att->subtype = str_dup ("octet-stream");
+ att->subtype = m_strdup("octet-stream");
}
}
new = mutt_new_body ();
new->type = TYPEMULTIPART;
- new->subtype = str_dup ("mixed");
+ new->subtype = m_strdup("mixed");
new->encoding = get_toplevel_encoding (b);
mutt_generate_boundary (&new->parameter);
new->use_disp = 0;
adr->next = NULL;
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), adr, display);
- len = str_len (buf);
+ len = m_strlen(buf);
if (count && linelen + len > 74) {
fputs ("\n\t", fp);
linelen = len + 8; /* tab is usually about 8 spaces... */
i = p - h->data;
++p;
SKIPWS (p);
- tmp = str_dup (p);
+ tmp = m_strdup(p);
if (!tmp)
continue;
rfc2047_encode_string (&tmp);
- p_realloc(&h->data, str_len(h->data) + 2 + str_len(tmp) + 1);
+ p_realloc(&h->data, m_strlen(h->data) + 2 + m_strlen(tmp) + 1);
sprintf (h->data + i, ": %s", NONULL (tmp)); /* __SPRINTF_CHECKED__ */
break;
case 'O':
snprintf (tmp, sizeof (tmp), "%lo", (unsigned long) now);
- str_ncat (buf, len, tmp, str_len (tmp));
+ str_ncat (buf, len, tmp, m_strlen(tmp));
break;
case 'p':
snprintf (tmp, sizeof (tmp), "%u", (unsigned int) getpid ());
- str_ncat (buf, len, tmp, str_len (tmp));
+ str_ncat (buf, len, tmp, m_strlen(tmp));
break;
case 'P':
snprintf (tmp, sizeof (tmp), "%c", MsgIdPfx);
break;
case 'r':
snprintf (tmp, sizeof (tmp), "%u", (unsigned int) rand ());
- str_ncat (buf, len, tmp, str_len (tmp));
+ str_ncat (buf, len, tmp, m_strlen(tmp));
break;
case 'R':
snprintf (tmp, sizeof (tmp), "%x", (unsigned int) rand ());
- str_ncat (buf, len, tmp, str_len (tmp));
+ str_ncat (buf, len, tmp, m_strlen(tmp));
break;
case 's':
snprintf (tmp, sizeof (tmp), "%02d", tm->tm_sec);
break;
case 'T':
snprintf (tmp, sizeof (tmp), "%u", (unsigned int) now);
- str_ncat (buf, len, tmp, str_len (tmp));
+ str_ncat (buf, len, tmp, m_strlen(tmp));
break;
case 'X':
snprintf (tmp, sizeof (tmp), "%x", (unsigned int) now);
- str_ncat (buf, len, tmp, str_len (tmp));
+ str_ncat (buf, len, tmp, m_strlen(tmp));
break;
case 'Y':
snprintf (tmp, sizeof (tmp), "%04d", tm->tm_year + 1900); /* this will break in the year 10000 ;-) */
if (!(fqdn = mutt_fqdn (0)))
fqdn = NONULL (Hostname);
- localpart_length = sizeof (buf) - str_len (fqdn) - 4; /* the 4 characters are '<', '@', '>' and '\0' */
+ localpart_length = sizeof (buf) - m_strlen(fqdn) - 4; /* the 4 characters are '<', '@', '>' and '\0' */
mutt_gen_localpart (localpart, localpart_length, MsgIdFormat);
snprintf (buf, sizeof (buf), "<%s@%s>", localpart, fqdn);
- return (str_dup (buf));
+ return (m_strdup(buf));
}
static RETSIGTYPE alarm_handler (int sig)
char tmp[_POSIX_PATH_MAX];
mutt_mktemp (tmp);
- *tempfile = str_dup (tmp);
+ *tempfile = m_strdup(tmp);
}
if ((pid = fork ()) == 0) {
return i;
}
- s = str_dup (cmd);
+ s = m_strdup(cmd);
}
else
#endif
- s = str_dup (Sendmail);
+ s = m_strdup(Sendmail);
ps = s;
i = 0;
if (i)
args[argslen++] = ps;
else {
- path = str_dup (ps);
+ path = m_strdup(ps);
ps = strrchr (ps, '/');
if (ps)
ps++;
string. */
char *mutt_append_string (char *a, const char *b)
{
- size_t la = str_len (a);
+ size_t la = m_strlen(a);
- p_realloc(&a, la + str_len(b) + 1);
+ p_realloc(&a, la + m_strlen(b) + 1);
strcpy (a + la, b); /* __STRCPY_CHECKED__ */
return (a);
}
char *r, *pr;
size_t rlen;
- rlen = str_len (s) + 3;
+ rlen = m_strlen(s) + 3;
pr = r = p_new(char, rlen);
*pr++ = '"';
while (*s) {
rfc822_cat (buffer, sizeof (buffer), "undisclosed-recipients",
RFC822Specials);
- env->to->mailbox = str_dup (buffer);
+ env->to->mailbox = m_strdup(buffer);
}
mutt_set_followup_to (env);
*/
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "buffy.h"
#include "keymap.h"
-#include "lib/str.h"
#include <libgen.h>
#include <ctype.h>
{
int dots = 0;
char *last_dot = NULL;
- int i, j, len = str_len (box);
+ int i, j, len = m_strlen(box);
char *new_box;
if (!SidebarBoundary || !*SidebarBoundary)
- return (str_dup (box));
+ return (m_strdup(box));
for (i = 0; i < len; ++i) {
if (strchr (SidebarBoundary, box[i])) {
if (strchr (SidebarBoundary, box[i])) {
new_box[j++] = box[i];
new_box[j] = 0;
- if (&box[i + 1] != last_dot || j + str_len (last_dot) > maxlen) {
+ if (&box[i + 1] != last_dot || j + m_strlen(last_dot) > maxlen) {
new_box[j++] = box[i + 1];
new_box[j] = 0;
} else {
}
return new_box;
}
- return str_dup (box);
+ return m_strdup(box);
}
static const char* sidebar_number_format (char* dest, size_t destlen, char op,
int shortened = 0, lencnt = 0;
char no[SHORT_STRING], entry[SHORT_STRING];
#if USE_IMAP
- int l = str_len (ImapHomeNamespace);
+ int l = m_strlen(ImapHomeNamespace);
#endif
- int l_m = str_len (Maildir);
+ int l_m = m_strlen(Maildir);
if (SidebarWidth > COLS)
SidebarWidth = COLS;
mutt_FormatString (no, len, NONULL (SidebarNumberFormat),
sidebar_number_format, idx, M_FORMAT_OPTIONAL);
- lencnt = str_len (no);
+ lencnt = m_strlen(no);
memset (&entry, ' ', sizeof (entry));
#if USE_IMAP
if (l > 0 && str_ncmp (box, ImapHomeNamespace, l) == 0 &&
- str_len (box) > l)
+ m_strlen(box) > l)
box += l + 1; /* we're trimming the ImapHomeNamespace, the "+ 1" is for the separator */
else
#endif
if (l_m > 0 && str_ncmp (box, Maildir, l_m) == 0 &&
- str_len (box) > l_m) {
+ m_strlen(box) > l_m) {
box += l_m;
if (Maildir[strlen(Maildir)-1]!='/') {
box += 1;
} else
box = basename (box);
- if (option (OPTSHORTENHIERARCHY) && str_len (box) > len-lencnt-1) {
+ if (option (OPTSHORTENHIERARCHY) && m_strlen(box) > len-lencnt-1) {
box = shortened_hierarchy (box, len-lencnt-1);
shortened = 1;
}
snprintf (entry, len-lencnt, "%s", box);
- entry[str_len (entry)] = ' ';
+ entry[m_strlen(entry)] = ' ';
strncpy (entry + (len - lencnt), no, lencnt);
addnstr (entry, len);
if (!option(OPTMBOXPANE) || SidebarWidth==0)
return;
- delim_len=str_len(NONULL(SidebarDelim));
+ delim_len=m_strlen(NONULL(SidebarDelim));
/* draw vertical delimiter */
SETCOLOR (MT_COLOR_SIDEBAR);
last_line = LINES - 2 + (option (OPTSTATUSONTOP) && !option (OPTHELP) ? 1 : 0),
i = 0,line;
BUFFY *tmp;
- size_t delim_len = str_len (SidebarDelim);
+ size_t delim_len = m_strlen(SidebarDelim);
char blank[SHORT_STRING];
known_lines=last_line-first_line;
}
if (SidebarWidth > 0 && option (OPTMBOXPANE)
- && str_len (SidebarDelim) >= SidebarWidth) {
+ && m_strlen(SidebarDelim) >= SidebarWidth) {
mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
sleep (2);
unset_option (OPTMBOXPANE);
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mime.h"
#include "copy.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <sys/wait.h>
if (!mailbox && !query)
return (NULL);
- addr_len = mailbox ? str_len (mailbox) : 0;
- query_len = query ? str_len (query) : 0;
+ addr_len = mailbox ? m_strlen(mailbox) : 0;
+ query_len = query ? m_strlen(query) : 0;
*key = '\0';
}
- /* Note: str_dup ("") returns NULL. */
- return str_dup (key);
+ /* Note: m_strdup("") returns NULL. */
+ return m_strdup(key);
}
if (k) {
/* the key used last time. */
if (*SmimeKeyToUse &&
- !str_casecmp (k, SmimeKeyToUse + str_len (SmimeKeys) + 1)) {
+ !str_casecmp (k, SmimeKeyToUse + m_strlen(SmimeKeys) + 1)) {
p_delete(&k);
return;
}
if (*SmimeKeyToUse) {
if (!str_casecmp (SmimeDefaultKey,
- SmimeKeyToUse + str_len (SmimeKeys) + 1))
+ SmimeKeyToUse + m_strlen(SmimeKeys) + 1))
return;
smime_void_passphrase ();
return NULL;
}
- keylist_size += str_len (keyID) + 2;
+ keylist_size += m_strlen(keyID) + 2;
p_realloc(&keylist, keylist_size);
sprintf (keylist + keylist_used, "%s\n", keyID); /* __SPRINTF_CHECKED__ */
- keylist_used = str_len (keylist);
+ keylist_used = m_strlen(keylist);
rfc822_free_address (&addr);
while ((fgets (email, sizeof (email), fpout))) {
- *(email + str_len (email) - 1) = '\0';
- if (str_ncasecmp (email, mailbox, str_len (mailbox)) == 0)
+ *(email + m_strlen(email) - 1) = '\0';
+ if (str_ncasecmp (email, mailbox, m_strlen(mailbox)) == 0)
ret = 1;
ret = ret < 0 ? 0 : ret;
rewind (fpout);
while ((fgets (email, sizeof (email), fpout))) {
- *(email + str_len (email) - 1) = '\0';
- (*buffer)[count] = p_dupstr(email, str_len(email));
+ *(email + m_strlen(email) - 1) = '\0';
+ (*buffer)[count] = p_dupstr(email, m_strlen(email));
count++;
}
}
fclose (fpout);
fclose (fperr);
- return str_dup (certfile);
+ return m_strdup(certfile);
}
static char *smime_extract_signer_certificate (char *infile)
fclose (fpout);
fclose (fperr);
- return str_dup (certfile);
+ return m_strdup(certfile);
}
*certfile = '\0';
while (1) {
- int off = str_len (certfile);
+ int off = m_strlen(certfile);
while (*++cert_end && *cert_end != '\n');
if (!*cert_end)
t = mutt_new_body ();
t->type = TYPEAPPLICATION;
- t->subtype = str_dup ("x-pkcs7-mime");
+ t->subtype = m_strdup("x-pkcs7-mime");
mutt_set_parameter ("name", "smime.p7m", &t->parameter);
mutt_set_parameter ("smime-type", "enveloped-data", &t->parameter);
t->encoding = ENCBASE64; /* The output of OpenSSL SHOULD be binary */
t->use_disp = 1;
t->disposition = DISPATTACH;
- t->d_filename = str_dup ("smime.p7m");
- t->filename = str_dup (tempfile);
+ t->d_filename = m_strdup("smime.p7m");
+ t->filename = m_strdup(tempfile);
t->unlink = 1; /*delete after sending the message */
t->parts = 0;
t->next = 0;
t = mutt_new_body ();
t->type = TYPEMULTIPART;
- t->subtype = str_dup ("signed");
+ t->subtype = m_strdup("signed");
t->encoding = ENC7BIT;
t->use_disp = 0;
t->disposition = DISPINLINE;
t->parts->next = mutt_new_body ();
t = t->parts->next;
t->type = TYPEAPPLICATION;
- t->subtype = str_dup ("x-pkcs7-signature");
- t->filename = str_dup (signedfile);
- t->d_filename = str_dup ("smime.p7s");
+ t->subtype = m_strdup("x-pkcs7-signature");
+ t->filename = m_strdup(signedfile);
+ t->d_filename = m_strdup("smime.p7s");
t->use_disp = 1;
t->disposition = DISPATTACH;
t->encoding = ENCBASE64;
}
}
while (fgets (buf, sizeof (buf) - 1, smimeout) != NULL) {
- len = str_len (buf);
+ len = m_strlen(buf);
if (len > 1 && buf[len - 2] == '\r') {
buf[len - 2] = '\n';
buf[len - 1] = '\0';
#endif
#include <lib-lib/macros.h>
+#include <lib-lib/str.h>
#include "mutt.h"
#include "sort.h"
#include "thread.h"
#include "mutt_idna.h"
-#include "lib/str.h"
#include <stdlib.h>
#include <string.h>
if (s->flags & M_PENDINGPREFIX) {
int i;
- i = str_len (Quotebuf);
+ i = m_strlen(Quotebuf);
Quotebuf[i++] = c;
Quotebuf[i] = '\0';
if (i == sizeof (Quotebuf) - 1 || c == '\n') {
snprintf (buf, sizeof (buf), "%s%s", NONULL (s->prefix), Quotebuf);
#ifdef DEBUG
- if (str_len (buf) >= 2) {
- save = buf[str_len (buf) - 1];
- buf[str_len (buf) - 1] = '\0';
+ if (m_strlen(buf) >= 2) {
+ save = buf[m_strlen(buf) - 1];
+ buf[m_strlen(buf) - 1] = '\0';
debug_print (2, ("buf = '%s'\n", buf));
- buf[str_len (buf)] = save;
+ buf[m_strlen(buf)] = save;
}
#endif
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "mx.h"
#include "buffy.h"
-#include "lib/str.h"
#include <string.h>
#include <ctype.h>
if (!StChars)
buf[0] = 0;
- else if (i >= str_len (StChars))
+ else if (i >= m_strlen(StChars))
buf[0] = StChars[0];
else
buf[0] = StChars[i];
mutt_break_thread (child);
child->env->in_reply_to = mutt_new_list ();
- child->env->in_reply_to->data = str_dup (parent->env->message_id);
+ child->env->in_reply_to->data = m_strdup(parent->env->message_id);
mutt_set_flag (ctx, child, M_TAG, 0);
if (ciss->host) {
str_cat (dest, len, "//");
- len -= (l = str_len (dest));
+ len -= (l = m_strlen(dest));
dest += l;
if (ciss->user) {
else
snprintf (dest, len, "%s@", ciss->user);
- len -= (l = str_len (dest));
+ len -= (l = m_strlen(dest));
dest += l;
}
if (!(t = strchr (src, ':')))
return -1;
- if ((tmp = str_dup (t + 1)) == NULL)
+ if ((tmp = m_strdup(t + 1)) == NULL)
return -1;
if ((headers = strchr (tmp, '?')))
}
else {
#define SAFEPFX (option (OPTSTRICTMAILTO) ? "" : "X-Mailto-")
- taglen = str_len (tag) + str_len (SAFEPFX);
+ taglen = m_strlen(tag) + m_strlen(SAFEPFX);
/* mutt_parse_rfc822_line makes some assumptions */
snprintf (scratch, sizeof (scratch), "%s%s: %s", SAFEPFX, tag, value);
#undef SAVEPFX
* please see the file GPL in the top level source directory.
*/
#include <stdio.h>
+#include <lib-lib/str.h>
#include "xterm.h"
-#include "lib/str.h"
void mutt_xterm_set_title (const char *title) {
fputs ("\033]2;", stdout);