/* mutt_account_match: compare account info (host/port/user/login) */
int mutt_account_match (const ACCOUNT * a1, const ACCOUNT * a2)
{
- const char* user = NONULL (Username);
- const char* login = NONULL (Username);
+ const char* user = NONULL (Username);
+ const char* login = NONULL (Username);
- if (a1->type != a2->type)
- return 0;
- if (ascii_strcasecmp (a1->host, a2->host))
- return 0;
- if (a1->port != a2->port)
- return 0;
+ if (a1->type != a2->type)
+ return 0;
+ if (ascii_strcasecmp (a1->host, a2->host))
+ return 0;
+ if (a1->port != a2->port)
+ return 0;
#ifdef USE_IMAP
- if (a1->type == M_ACCT_TYPE_IMAP) {
- if (ImapUser && (ImapUser[0] != '\0'))
- user = ImapUser;
- if (ImapLogin && (ImapLogin[0] != '\0'))
- login = ImapLogin;
- }
+ if (a1->type == M_ACCT_TYPE_IMAP) {
+ if (ImapUser && (ImapUser[0] != '\0'))
+ user = ImapUser;
+ if (ImapLogin && (ImapLogin[0] != '\0'))
+ login = ImapLogin;
+ }
#endif
#ifdef USE_POP
- if (a1->type == M_ACCT_TYPE_POP && PopUser)
- user = PopUser;
+ if (a1->type == M_ACCT_TYPE_POP && PopUser)
+ user = PopUser;
#endif
#ifdef USE_NNTP
- if (a1->type == M_ACCT_TYPE_NNTP && NntpUser)
- user = NntpUser;
+ if (a1->type == M_ACCT_TYPE_NNTP && NntpUser)
+ user = NntpUser;
#endif
- if (a1->flags & a2->flags & M_ACCT_USER)
- return (!m_strcmp(a1->user, a2->user));
- if (a1->flags & M_ACCT_USER)
- return (!m_strcmp(a1->user, user));
- if (a2->flags & M_ACCT_USER)
- return (!m_strcmp(a2->user, user));
+ if (a1->flags & a2->flags & M_ACCT_USER)
+ return (!m_strcmp(a1->user, a2->user));
+ if (a1->flags & M_ACCT_USER)
+ return (!m_strcmp(a1->user, user));
+ if (a2->flags & M_ACCT_USER)
+ return (!m_strcmp(a2->user, user));
- return 1;
+ return 1;
}
/* mutt_account_fromurl: fill account with information from url. */
-int mutt_account_fromurl (ACCOUNT * account, ciss_url_t * url)
+int mutt_account_fromurl(ACCOUNT *account, ciss_url_t *url)
{
- /* must be present */
- if (url->host)
- strfcpy (account->host, url->host, sizeof (account->host));
- else
- return -1;
-
- if (url->user) {
- strfcpy (account->user, url->user, sizeof (account->user));
- account->flags |= M_ACCT_USER;
- }
- if (url->pass) {
- strfcpy (account->pass, url->pass, sizeof (account->pass));
- account->flags |= M_ACCT_PASS;
- }
- if (url->port) {
- account->port = url->port;
- account->flags |= M_ACCT_PORT;
- }
+ /* must be present */
+ if (!url->host)
+ return -1;
+ m_strcpy(account->host, sizeof(account->host), url->host);
+
+ if (url->user) {
+ m_strcpy(account->user, sizeof(account->user), url->user);
+ account->flags |= M_ACCT_USER;
+ }
+ if (url->pass) {
+ m_strcpy(account->pass, sizeof(account->pass), url->pass);
+ account->flags |= M_ACCT_PASS;
+ }
+ if (url->port) {
+ account->port = url->port;
+ account->flags |= M_ACCT_PORT;
+ }
- return 0;
+ return 0;
}
/* mutt_account_tourl: fill URL with info from account. The URL information
* a while). */
void mutt_account_tourl (ACCOUNT * account, ciss_url_t * url)
{
- url->scheme = U_UNKNOWN;
- url->user = NULL;
- url->pass = NULL;
- url->port = 0;
+ url->scheme = U_UNKNOWN;
+ url->user = NULL;
+ url->pass = NULL;
+ url->port = 0;
#ifdef USE_IMAP
- if (account->type == M_ACCT_TYPE_IMAP) {
- if (account->flags & M_ACCT_SSL)
- url->scheme = U_IMAPS;
- else
- url->scheme = U_IMAP;
- }
+ if (account->type == M_ACCT_TYPE_IMAP) {
+ if (account->flags & M_ACCT_SSL)
+ url->scheme = U_IMAPS;
+ else
+ url->scheme = U_IMAP;
+ }
#endif
#ifdef USE_POP
- if (account->type == M_ACCT_TYPE_POP) {
- if (account->flags & M_ACCT_SSL)
- url->scheme = U_POPS;
- else
- url->scheme = U_POP;
- }
+ if (account->type == M_ACCT_TYPE_POP) {
+ if (account->flags & M_ACCT_SSL)
+ url->scheme = U_POPS;
+ else
+ url->scheme = U_POP;
+ }
#endif
#ifdef USE_NNTP
- if (account->type == M_ACCT_TYPE_NNTP) {
- if (account->flags & M_ACCT_SSL)
- url->scheme = U_NNTPS;
- else
- url->scheme = U_NNTP;
- }
+ if (account->type == M_ACCT_TYPE_NNTP) {
+ if (account->flags & M_ACCT_SSL)
+ url->scheme = U_NNTPS;
+ else
+ url->scheme = U_NNTP;
+ }
#endif
- url->host = account->host;
- if (account->flags & M_ACCT_PORT)
- url->port = account->port;
- if (account->flags & M_ACCT_USER)
- url->user = account->user;
- if (account->flags & M_ACCT_PASS)
- url->pass = account->pass;
+ url->host = account->host;
+ if (account->flags & M_ACCT_PORT)
+ url->port = account->port;
+ if (account->flags & M_ACCT_USER)
+ url->user = account->user;
+ if (account->flags & M_ACCT_PASS)
+ url->pass = account->pass;
}
/* mutt_account_getuser: retrieve username into ACCOUNT, if necessary */
int mutt_account_getuser (ACCOUNT * account)
{
- char prompt[SHORT_STRING];
+ char prompt[SHORT_STRING];
- /* already set */
- if (account->flags & M_ACCT_USER)
- return 0;
+ /* already set */
+ if (account->flags & M_ACCT_USER)
+ return 0;
#ifdef USE_IMAP
- else if ((account->type == M_ACCT_TYPE_IMAP) && m_strlen(ImapUser))
- strfcpy (account->user, ImapUser, sizeof (account->user));
+ else if ((account->type == M_ACCT_TYPE_IMAP) && !m_strisempty(ImapUser))
+ m_strcpy(account->user, sizeof(account->user), ImapUser);
#endif
#ifdef USE_POP
- else if ((account->type == M_ACCT_TYPE_POP) && m_strlen(PopUser))
- strfcpy (account->user, PopUser, sizeof (account->user));
+ else if ((account->type == M_ACCT_TYPE_POP) && !m_strisempty(PopUser))
+ m_strcpy(account->user, sizeof(account->user), PopUser);
#endif
#ifdef USE_NNTP
- else if ((account->type == M_ACCT_TYPE_NNTP) && m_strlen(NntpUser))
- strfcpy (account->user, NntpUser, sizeof (account->user));
+ else if ((account->type == M_ACCT_TYPE_NNTP) && !m_strisempty(NntpUser))
+ m_strcpy(account->user, sizeof(account->user), NntpUser);
#endif
- /* prompt (defaults to unix username), copy into account->user */
- else {
- snprintf (prompt, sizeof (prompt), _("Username at %s: "), account->host);
- strfcpy (account->user, NONULL(Username), sizeof (account->user));
- if (mutt_get_field_unbuffered (prompt, account->user,
- sizeof (account->user), 0))
- return -1;
- }
-
- account->flags |= M_ACCT_USER;
-
- return 0;
+ /* prompt (defaults to unix username), copy into account->user */
+ else {
+ snprintf(prompt, sizeof(prompt), _("Username at %s: "), account->host);
+ m_strcpy(account->user, sizeof(account->user), NONULL(Username));
+ if (mutt_get_field_unbuffered(prompt, account->user,
+ sizeof(account->user), 0))
+ return -1;
+ }
+
+ account->flags |= M_ACCT_USER;
+
+ return 0;
}
int mutt_account_getlogin (ACCOUNT* account)
{
- /* already set */
- if (account->flags & M_ACCT_LOGIN)
- return 0;
+ /* already set */
+ if (account->flags & M_ACCT_LOGIN)
+ return 0;
#ifdef USE_IMAP
- else if (account->type == M_ACCT_TYPE_IMAP)
- {
- if (ImapLogin && (ImapLogin[0] != '\0')) {
- strfcpy (account->login, ImapLogin, sizeof (account->login));
- account->flags |= M_ACCT_LOGIN;
+ else if (account->type == M_ACCT_TYPE_IMAP)
+ {
+ if (!m_strisempty(ImapLogin)) {
+ m_strcpy(account->login, sizeof(account->login), ImapLogin);
+ account->flags |= M_ACCT_LOGIN;
+ }
}
- }
#endif
- if (!(account->flags & M_ACCT_LOGIN)) {
- mutt_account_getuser (account);
- strfcpy (account->login, account->user, sizeof (account->login));
- }
+ if (!(account->flags & M_ACCT_LOGIN)) {
+ mutt_account_getuser (account);
+ m_strcpy(account->login, sizeof(account->login), account->user);
+ }
- account->flags |= M_ACCT_LOGIN;
+ account->flags |= M_ACCT_LOGIN;
- return 0;
+ return 0;
}
/* mutt_account_getpass: fetch password into ACCOUNT, if neccessary */
int mutt_account_getpass (ACCOUNT * account)
{
- char prompt[SHORT_STRING];
+ char prompt[SHORT_STRING];
- if (account->flags & M_ACCT_PASS)
- return 0;
+ if (account->flags & M_ACCT_PASS)
+ return 0;
#ifdef USE_IMAP
- else if ((account->type == M_ACCT_TYPE_IMAP) && m_strlen(ImapPass))
- strfcpy (account->pass, ImapPass, sizeof (account->pass));
+ else if ((account->type == M_ACCT_TYPE_IMAP) && !m_strisempty(ImapPass))
+ m_strcpy(account->pass, sizeof(account->pass), ImapPass);
#endif
#ifdef USE_POP
- else if ((account->type == M_ACCT_TYPE_POP) && m_strlen(PopPass))
- strfcpy (account->pass, PopPass, sizeof (account->pass));
+ else if ((account->type == M_ACCT_TYPE_POP) && !m_strisempty(PopPass))
+ m_strcpy(account->pass, sizeof(account->pass), PopPass);
#endif
#ifdef USE_NNTP
- else if ((account->type == M_ACCT_TYPE_NNTP) && m_strlen(NntpPass))
- strfcpy (account->pass, NntpPass, sizeof (account->pass));
+ else if ((account->type == M_ACCT_TYPE_NNTP) && !m_strisempty(NntpPass))
+ m_strcpy(account->pass, sizeof(account->pass), NntpPass);
#endif
- else {
- snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "),
- account->flags & M_ACCT_LOGIN ? account->login : account->user,
- account->host);
- account->pass[0] = '\0';
- if (mutt_get_field_unbuffered (prompt, account->pass,
- sizeof (account->pass), M_PASS))
- return -1;
- }
-
- account->flags |= M_ACCT_PASS;
-
- return 0;
+ else {
+ snprintf(prompt, sizeof(prompt), _("Password for %s@%s: "),
+ account->flags & M_ACCT_LOGIN ? account->login : account->user,
+ account->host);
+ account->pass[0] = '\0';
+ if (mutt_get_field_unbuffered(prompt, account->pass,
+ sizeof(account->pass), M_PASS))
+ return -1;
+ }
+
+ account->flags |= M_ACCT_PASS;
+
+ return 0;
}
void mutt_account_unsetpass (ACCOUNT * account)
{
- account->flags &= !M_ACCT_PASS;
+ account->flags &= !M_ACCT_PASS;
}
}
if (adr && adr->mailbox) {
- strfcpy (buf, adr->mailbox, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), adr->mailbox);
if ((pc = strchr (buf, '@')))
*pc = 0;
}
switch (mutt_yesorno
(_("Warning: This alias name may not work. Fix it?"), M_YES)) {
case M_YES:
- strfcpy (buf, fixed, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), fixed);
goto retry_name;
case -1:
return;
mutt_addrlist_to_local (adr);
if (adr)
- strfcpy (buf, adr->mailbox, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), adr->mailbox);
else
buf[0] = 0;
}
while (new->addr == NULL);
- if (adr && adr->personal && !mutt_is_mail_list (adr))
- strfcpy (buf, adr->personal, sizeof (buf));
+ if (adr && adr->personal && !mutt_is_mail_list(adr))
+ m_strcpy(buf, sizeof(buf), adr->personal);
else
buf[0] = 0;
else
Aliases = new;
- strfcpy (buf, NONULL (AliasFile), sizeof (buf));
+ m_strcpy(buf, sizeof(buf), NONULL(AliasFile));
if (mutt_get_field (_("Save to file: "), buf, sizeof (buf), M_FILE) != 0)
return;
mutt_expand_path (buf, sizeof (buf));
if ((rc = safe_fopen (buf, "a"))) {
if (mutt_check_alias_name (new->name, NULL))
- mutt_quote_filename (buf, sizeof (buf), new->name);
+ mutt_quote_filename(buf, sizeof(buf), new->name);
else
- strfcpy (buf, new->name, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), new->name);
fprintf (rc, "alias %s ", buf);
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), new->addr, 0);
while (a) {
if (a->name && strstr (a->name, s) == a->name) {
if (!bestname[0]) /* init */
- strfcpy (bestname, a->name,
- min (m_strlen(a->name) + 1, sizeof (bestname)));
+ m_strcpy(bestname, MIN(m_strlen(a->name) + 1, sizeof(bestname)),
+ a->name);
else {
for (i = 0; a->name[i] && a->name[i] == bestname[i]; i++);
bestname[i] = 0;
if (bestname[0] != 0) {
if (m_strcmp(bestname, s) != 0) {
/* we are adding something to the completion */
- strfcpy (s, bestname, m_strlen(bestname) + 1);
+ m_strcpy(s, m_strlen(bestname) + 1, bestname);
return 1;
}
bestname[0] = 0;
mutt_alias_menu (bestname, sizeof (bestname), a_list ? a_list : Aliases);
if (bestname[0] != 0)
- strfcpy (s, bestname, buflen);
+ m_strcpy(s, buflen, bestname);
/* free the alias list */
while (a_list) {
if (entry->composecommand || entry->composetypecommand) {
if (entry->composetypecommand)
- strfcpy (command, entry->composetypecommand, sizeof (command));
+ m_strcpy(command, sizeof(command), entry->composetypecommand);
else
- strfcpy (command, entry->composecommand, sizeof (command));
+ m_strcpy(command, sizeof(command), entry->composecommand);
if (rfc1524_expand_filename (entry->nametemplate,
a->filename, newfile, sizeof (newfile))) {
debug_print (1, ("oldfile: %s\t newfile: %s\n", a->filename, newfile));
unlink_newfile = 1;
}
else
- strfcpy (newfile, a->filename, sizeof (newfile));
+ m_strcpy(newfile, sizeof(newfile), a->filename);
if (rfc1524_expand_command (a, newfile, type,
command, sizeof (command))) {
if (rfc1524_mailcap_lookup (a, type, entry, M_EDIT)) {
if (entry->editcommand) {
- strfcpy (command, entry->editcommand, sizeof (command));
+ m_strcpy(command, sizeof(command), entry->editcommand);
if (rfc1524_expand_filename (entry->nametemplate,
a->filename, newfile, sizeof (newfile))) {
debug_print (1, ("oldfile: %s\t newfile: %s\n", a->filename, newfile));
unlink_newfile = 1;
}
else
- strfcpy (newfile, a->filename, sizeof (newfile));
+ m_strcpy(newfile, sizeof(newfile), a->filename);
if (rfc1524_expand_command (a, newfile, type,
command, sizeof (command))) {
if (m_strcmp(p, "1") == 0)
return (1);
- strfcpy (tmp, p, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), p);
p = tmp;
while ((p = strtok (p, ",")) != NULL) {
goto return_error;
}
- strfcpy (command, entry->command, sizeof (command));
+ m_strcpy(command, sizeof(command), entry->command);
if (fp) {
fname = m_strdup(a->filename);
if (safe_symlink (a->filename, tempfile) == -1) {
if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES)
== M_YES)
- strfcpy (tempfile, a->filename, sizeof (tempfile));
+ m_strcpy(tempfile, sizeof(tempfile), a->filename);
else
goto return_error;
}
}
}
else if (fp == NULL) /* send case */
- strfcpy (tempfile, a->filename, sizeof (tempfile));
+ m_strcpy(tempfile, sizeof(tempfile), a->filename);
if (fp) {
/* recv case: we need to save the attachment to a file */
if (use_pager) {
if (fp && !use_mailcap && a->filename) {
/* recv case */
- strfcpy (pagerfile, a->filename, sizeof (pagerfile));
+ m_strcpy(pagerfile, sizeof(pagerfile), a->filename);
mutt_adv_mktemp (NULL, pagerfile, sizeof (pagerfile));
}
else
}
if (a->description)
- strfcpy (descrip, a->description, sizeof (descrip));
+ m_strcpy(descrip, sizeof(descrip), a->description);
else if (a->filename)
snprintf (descrip, sizeof (descrip), "---Attachment: %s : %s",
a->filename, type);
rfc1524_free_entry (&entry);
return 0;
}
- strfcpy (newfile, a->filename, sizeof (newfile));
+ m_strcpy(newfile, sizeof(newfile), a->filename);
}
else
unlink_newfile = 1;
if (fp)
mutt_save_attachment (fp, a, newfile, 0, NULL);
- strfcpy (command, entry->printcommand, sizeof (command));
- piped =
- rfc1524_expand_command (a, newfile, type, command, sizeof (command));
+ m_strcpy(command, sizeof(command), entry->printcommand);
+ piped = rfc1524_expand_command(a, newfile, type, command,
+ sizeof(command));
mutt_endwin (NULL);
(!S_ISLNK (s.st_mode)))
continue;
- strfcpy (buffer, NONULL (tmp->path), sizeof (buffer));
+ m_strcpy(buffer, sizeof(buffer), NONULL(tmp->path));
mutt_pretty_mailbox (buffer);
add_folder (menu, state, buffer, &s, NULL, tmp->new);
else
#endif
if (buffy)
- snprintf (title, titlelen, _("Mailboxes [%d]"), buffy_check (0));
+ snprintf(title, titlelen, _("Mailboxes [%d]"), buffy_check(0));
else {
- strfcpy (path, LastDir, sizeof (path));
+ m_strcpy(path, sizeof(path), LastDir);
mutt_pretty_mailbox (path);
#ifdef USE_IMAP
if (state->imap_browse && option (OPTIMAPLSUB))
p_clear(&state, 1);
if (!folder)
- strfcpy (LastDirBackup, LastDir, sizeof (LastDirBackup));
+ m_strcpy(LastDirBackup, sizeof(LastDirBackup), LastDir);
#ifdef USE_NNTP
if (option (OPTNEWS)) {
if (*f)
- strfcpy (prefix, f, sizeof (prefix));
+ m_strcpy(prefix, sizeof(prefix), f);
else {
LIST *list;
init_state (&state, NULL);
state.imap_browse = 1;
if (!imap_browse (f, &state))
- strfcpy (LastDir, state.folder, sizeof (LastDir));
+ m_strcpy(LastDir, sizeof(LastDir), state.folder);
}
else {
#endif
}
if (i <= 0 && f[0] != '/')
- strfcpy (prefix, f, sizeof (prefix));
+ m_strcpy(prefix, sizeof(prefix), f);
else
- strfcpy (prefix, f + i + 1, sizeof (prefix));
+ m_strcpy(prefix, sizeof(prefix), f + i + 1);
killPrefix = 1;
#ifdef USE_IMAP
}
if (!folder)
getcwd (LastDir, sizeof (LastDir));
else if (!LastDir[0])
- strfcpy (LastDir, NONULL (Maildir), sizeof (LastDir));
+ m_strcpy(LastDir, sizeof(LastDir), NONULL(Maildir));
#ifdef USE_IMAP
if (!buffy && imap_is_magic (LastDir, NULL) == M_IMAP) {
) {
/* make sure this isn't a MH or maildir mailbox */
if (buffy) {
- strfcpy (buf, state.entry[menu->current].name, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), state.entry[menu->current].name);
mutt_expand_path (buf, sizeof (buf));
}
#ifdef USE_IMAP
else if (state.imap_browse) {
- strfcpy (buf, state.entry[menu->current].name, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), state.entry[menu->current].name);
}
#endif
else
char OldLastDir[_POSIX_PATH_MAX];
/* save the old directory */
- strfcpy (OldLastDir, LastDir, sizeof (OldLastDir));
+ m_strcpy(OldLastDir, sizeof(OldLastDir), LastDir);
if (m_strcmp(state.entry[menu->current].name, "..") == 0) {
if (m_strcmp("..", LastDir + m_strlen(LastDir) - 2) == 0)
}
}
else if (buffy) {
- strfcpy (LastDir, state.entry[menu->current].name,
- sizeof (LastDir));
+ m_strcpy(LastDir, sizeof(LastDir),
+ state.entry[menu->current].name);
mutt_expand_path (LastDir, sizeof (LastDir));
}
#ifdef USE_IMAP
int n;
ciss_url_t url;
- strfcpy (LastDir, state.entry[menu->current].name,
- sizeof (LastDir));
+ m_strcpy(LastDir, sizeof(LastDir),
+ state.entry[menu->current].name);
/* tack on delimiter here */
n = m_strlen(LastDir) + 1;
mutt_concat_path(tmp, sizeof(tmp), LastDir,
state.entry[menu->current].name);
- strfcpy (LastDir, tmp, sizeof (LastDir));
+ m_strcpy(LastDir, sizeof(LastDir), tmp);
}
destroy_state (&state);
#endif
if (examine_directory (menu, &state, LastDir, prefix) == -1) {
/* try to restore the old values */
- strfcpy (LastDir, OldLastDir, sizeof (LastDir));
+ m_strcpy(LastDir, sizeof(LastDir), OldLastDir);
if (examine_directory (menu, &state, LastDir, prefix) == -1) {
- strfcpy (LastDir, NONULL (Homedir), sizeof (LastDir));
+ m_strcpy(LastDir, sizeof(LastDir), NONULL(Homedir));
goto bail;
}
}
if (buffy)
#endif
{
- strfcpy (f, state.entry[menu->current].name, flen);
+ m_strcpy(f, flen, state.entry[menu->current].name);
mutt_expand_path (f, flen);
}
#ifdef USE_IMAP
else if (state.imap_browse)
- strfcpy (f, state.entry[menu->current].name, flen);
+ m_strcpy(f, flen, state.entry[menu->current].name);
#endif
else
mutt_concat_path(f, flen, LastDir, state.entry[menu->current].name);
break;
#endif
- strfcpy (buf, LastDir, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), LastDir);
#ifdef USE_IMAP
if (!state.imap_browse)
#endif
mutt_expand_path (buf, sizeof (buf));
#ifdef USE_IMAP
if (imap_is_magic (buf, NULL) == M_IMAP) {
- strfcpy (LastDir, buf, sizeof (LastDir));
+ m_strcpy(LastDir, sizeof(LastDir), buf);
destroy_state (&state);
init_state (&state, NULL);
state.imap_browse = 1;
if (S_ISDIR (st.st_mode)) {
destroy_state (&state);
if (examine_directory (menu, &state, buf, prefix) == 0)
- strfcpy (LastDir, buf, sizeof (LastDir));
+ m_strcpy(LastDir, sizeof(LastDir), buf);
else {
mutt_error _("Error scanning directory.");
case OP_ENTER_MASK:
- strfcpy (buf, NONULL (Mask.pattern), sizeof (buf));
+ m_strcpy(buf, sizeof(buf), NONULL(Mask.pattern));
if (mutt_get_field (_("File Mask: "), buf, sizeof (buf), 0) == 0) {
regex_t *rx = p_new(regex_t, 1);
char *s = buf;
buffy = 0;
/* assume that the user wants to see everything */
if (!buf[0])
- strfcpy (buf, ".", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), ".");
SKIPWS (s);
if (*s == '!') {
s++;
snprintf (buf, sizeof (buf), "%s/", LastDir);
if (mutt_get_field (_("New file name: "), buf, sizeof (buf), M_FILE) ==
0) {
- strfcpy (f, buf, flen);
+ m_strcpy(f, flen, buf);
destroy_state (&state);
mutt_menuDestroy (&menu);
goto bail;
#ifdef USE_IMAP
if (state.entry[menu->current].selectable) {
- strfcpy (f, state.entry[menu->current].name, flen);
+ m_strcpy(f, flen, state.entry[menu->current].name);
destroy_state (&state);
mutt_menuDestroy (&menu);
goto bail;
bail:
if (!folder)
- strfcpy (LastDir, LastDirBackup, sizeof (LastDir));
+ m_strcpy(LastDir, sizeof(LastDir), LastDirBackup);
}
while (MoreArgs (s)) {
mutt_extract_token (path, s, 0);
- strfcpy (buf, path->data, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), path->data);
if (data == M_UNMAILBOXES && str_eq (buf, "*")) {
list_del (&Incoming, (list_del_t*) buffy_free);
if (tmp->new <= 0 || (have_unnotified && tmp->notified))
continue;
- strfcpy (path, tmp->path, sizeof (path));
+ m_strcpy(path, sizeof(path), tmp->path);
mutt_pretty_mailbox (path);
if (!first && pos + m_strlen(path) >= COLS - 7)
* reported new mail */
buffy_check (0);
} else {
- strfcpy (s, ((BUFFY*) Incoming->data[c])->path, slen);
+ m_strcpy(s, slen, ((BUFFY*)Incoming->data[c])->path);
mutt_pretty_mailbox (s);
}
}
char buff[LONG_STRING];
char buff2[LONG_STRING];
- strfcpy (buff, nl_langinfo (CODESET), sizeof (buff));
+ m_strcpy(buff, sizeof(buff), nl_langinfo(CODESET));
mutt_canonical_charset (buff2, sizeof (buff2), buff);
/* finally, set $charset */
else if (!ascii_strncasecmp (name, "iso8859-", 8))
snprintf (scratch, sizeof (scratch), "iso_8859-%s", name + 8);
else
- strfcpy (scratch, NONULL (name), sizeof (scratch));
+ m_strcpy(scratch, sizeof(scratch), NONULL(name));
for (i = 0; PreferredMIMENames[i].key; i++)
if (!ascii_strcasecmp (scratch, PreferredMIMENames[i].key) ||
!m_strcasecmp(scratch, PreferredMIMENames[i].key)) {
- strfcpy (dest, PreferredMIMENames[i].pref, dlen);
+ m_strcpy(dest, dlen, PreferredMIMENames[i].pref);
return;
}
- strfcpy (dest, scratch, dlen);
+ m_strcpy(dest, dlen, scratch);
/* for cosmetics' sake, transform to lowercase. */
for (p = dest; *p; p++)
return "us-ascii";
if (!(c1 = strchr (c, ':')))
return ((char*) charset);
- strfcpy (fcharset, c, c1 - c + 1);
+ m_strcpy(fcharset, c1 - c + 1, c);
return fcharset;
}
switch (val) {
case COLOR_YELLOW:
- strfcpy (dest, missing[0], destlen);
+ m_strcpy(dest, destlen, missing[0]);
return dest;
case COLOR_WHITE:
- strfcpy (dest, missing[1], destlen);
+ m_strcpy(dest, destlen, missing[1]);
return dest;
case COLOR_DEFAULT:
- strfcpy (dest, missing[2], destlen);
+ m_strcpy(dest, destlen, missing[2]);
return dest;
}
for (i = 0; Colors[i].name; i++) {
if (Colors[i].value == val) {
- strfcpy (dest, Colors[i].name, destlen);
+ m_strcpy(dest, destlen, Colors[i].name);
return dest;
}
}
if (is_index) {
int i;
- strfcpy (buf, NONULL (s), sizeof (buf));
+ m_strcpy(buf, sizeof(buf), NONULL(s));
mutt_check_simple (buf, sizeof (buf), NONULL (SimpleSearch));
if ((tmp->color_pattern =
mutt_pattern_comp (buf, M_FULL_MSG, err)) == NULL) {
char *eptr;
if (!MoreArgs (s)) {
- strfcpy (err->data, _("Missing arguments."), err->dsize);
+ m_strcpy(err->data, err->dsize, _("Missing arguments."));
return -1;
}
BUFFER * err)
{
if (!MoreArgs (s)) {
- strfcpy (err->data, _("color: too few arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("color: too few arguments"));
return (-1);
}
return (-1);
if (!MoreArgs (s)) {
- strfcpy (err->data, _("color: too few arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("color: too few arguments"));
return (-1);
}
*bg = -1;
if (!MoreArgs (s)) {
- strfcpy (err->data, _("mono: too few arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("mono: too few arguments"));
return (-1);
}
if (object == MT_COLOR_HEADER || object == MT_COLOR_BODY
|| object == MT_COLOR_INDEX) {
if (!MoreArgs (s)) {
- strfcpy (err->data, _("too few arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("too few arguments"));
return (-1);
}
}
if (MoreArgs (s)) {
- strfcpy (err->data, _("too many arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("too many arguments"));
return (-1);
}
/* delay use_default_colors() until needed, since it initializes things */
&& (fg == COLOR_DEFAULT || bg == COLOR_DEFAULT)
&& use_default_colors () != OK) {
- strfcpy (err->data, _("default colors not supported"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("default colors not supported"));
return (-1);
}
# endif /* HAVE_USE_DEFAULT_COLORS */
int rc;
if (h)
- strfcpy (prompt, _("Bounce message to: "), sizeof (prompt));
+ m_strcpy(prompt, sizeof(prompt), _("Bounce message to: "));
else
- strfcpy (prompt, _("Bounce tagged messages to: "), sizeof (prompt));
+ m_strcpy(prompt, sizeof(prompt), _("Bounce tagged messages to: "));
rc = mutt_get_field (prompt, buf, sizeof (buf), M_ALIAS);
buf[0] = 0;
if (mutt_get_field (_("Shell command: "), buf, sizeof (buf), M_CMD) == 0) {
if (!buf[0] && Shell)
- strfcpy (buf, Shell, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), Shell);
if (buf[0]) {
CLEARLINE (LINES - 1);
mutt_endwin (NULL);
* Leitner <leitner@prz.fu-berlin.de>
*/
if (m_strcmp(buf, ".") == 0)
- strfcpy (buf, LastSaveFolder, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), LastSaveFolder);
else
- strfcpy (LastSaveFolder, buf, sizeof (LastSaveFolder));
+ m_strcpy(LastSaveFolder, sizeof(LastSaveFolder), buf);
mutt_expand_path (buf, sizeof (buf));
short type_changed = 0;
cp = mutt_get_parameter ("charset", b->parameter);
- strfcpy (charset, NONULL (cp), sizeof (charset));
+ m_strcpy(charset, sizeof(charset), NONULL(cp));
snprintf (buf, sizeof (buf), "%s/%s", TYPE (b), b->subtype);
- strfcpy (obuf, buf, sizeof (obuf));
+ m_strcpy(obuf, sizeof(obuf), buf);
if (b->parameter) {
size_t l;
if (option (OPTNEWS)) {
LIST *l = CurrentNewsSrv->list;
- strfcpy (filepart, s, sizeof (filepart));
+ m_strcpy(filepart, sizeof(filepart), s);
/*
* special case to handle when there is no filepart yet.
NNTP_DATA *data = (NNTP_DATA *) l->data;
if (data && data->subscribed) {
- strfcpy (filepart, data->group, sizeof (filepart));
+ m_strcpy(filepart, sizeof(filepart), data->group);
init++;
l = l->next;
break;
filepart[i] = 0;
}
else {
- strfcpy (filepart, data->group, sizeof (filepart));
+ m_strcpy(filepart, sizeof(filepart), data->group);
init = 1;
}
}
mutt_concat_path(imap_path, sizeof(imap_path), q, s + 1);
}
else
- strfcpy (imap_path, s, sizeof (imap_path));
+ m_strcpy(imap_path, sizeof(imap_path), s);
if (mx_get_magic (imap_path) == M_IMAP)
return imap_complete (s, slen, imap_path);
dirpart[0] = *s;
dirpart[1] = 0;
if (*s == '!')
- strfcpy (exp_dirpart, NONULL (Spoolfile), sizeof (exp_dirpart));
+ m_strcpy(exp_dirpart, sizeof(exp_dirpart), NONULL(Spoolfile));
else
- strfcpy (exp_dirpart, NONULL (Maildir), sizeof (exp_dirpart));
+ m_strcpy(exp_dirpart, sizeof(exp_dirpart), NONULL(Maildir));
if ((p = strrchr (s, '/'))) {
char buf[_POSIX_PATH_MAX];
*p++ = 0;
mutt_concat_path(buf, sizeof(buf), exp_dirpart, s + 1);
- strfcpy (exp_dirpart, buf, sizeof (exp_dirpart));
+ m_strcpy(exp_dirpart, sizeof(exp_dirpart), buf);
snprintf (buf, sizeof (buf), "%s%s/", dirpart, s + 1);
- strfcpy (dirpart, buf, sizeof (dirpart));
- strfcpy (filepart, p, sizeof (filepart));
+ m_strcpy(dirpart, sizeof(dirpart), buf);
+ m_strcpy(filepart, sizeof(filepart), p);
}
else
- strfcpy (filepart, s + 1, sizeof (filepart));
+ m_strcpy(filepart, sizeof(filepart), s + 1);
dirp = opendir (exp_dirpart);
}
else {
if ((p = strrchr (s, '/'))) {
if (p == s) { /* absolute path */
p = s + 1;
- strfcpy (dirpart, "/", sizeof (dirpart));
+ m_strcpy(dirpart, sizeof(dirpart), "/");
exp_dirpart[0] = 0;
- strfcpy (filepart, p, sizeof (filepart));
+ m_strcpy(filepart, sizeof(filepart), p);
dirp = opendir (dirpart);
}
else {
memcpy(dirpart, s, len);
dirpart[len] = 0;
p++;
- strfcpy (filepart, p, sizeof (filepart));
- strfcpy (exp_dirpart, dirpart, sizeof (exp_dirpart));
+ m_strcpy(filepart, sizeof(filepart), p);
+ m_strcpy(exp_dirpart, sizeof(exp_dirpart), dirpart);
mutt_expand_path (exp_dirpart, sizeof (exp_dirpart));
dirp = opendir (exp_dirpart);
}
else {
/* no directory name, so assume current directory. */
dirpart[0] = 0;
- strfcpy (filepart, s, sizeof (filepart));
+ m_strcpy(filepart, sizeof(filepart), s);
dirp = opendir (".");
}
}
while ((de = readdir (dirp)) != NULL) {
if (m_strcmp(".", de->d_name) != 0
&& m_strcmp("..", de->d_name) != 0) {
- strfcpy (filepart, de->d_name, sizeof (filepart));
+ m_strcpy(filepart, sizeof(filepart), de->d_name);
init++;
break;
}
char buf[_POSIX_PATH_MAX];
struct stat st;
- strfcpy (filepart, de->d_name, sizeof (filepart));
+ m_strcpy(filepart, sizeof(filepart), de->d_name);
/* check to see if it is a directory */
if (dirpart[0]) {
- strfcpy (buf, exp_dirpart, sizeof (buf));
- strfcpy (buf + m_strlen(buf), "/", sizeof (buf) - m_strlen(buf));
+ m_strcpy(buf, sizeof(buf), exp_dirpart);
+ m_strcpy(buf + m_strlen(buf), sizeof(buf) - m_strlen(buf), "/");
}
else
buf[0] = 0;
- strfcpy (buf + m_strlen(buf), filepart, sizeof (buf) - m_strlen(buf));
+ m_strcpy(buf + m_strlen(buf), sizeof(buf) - m_strlen(buf), filepart);
if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR))
- strfcpy (filepart + m_strlen(filepart), "/",
- sizeof (filepart) - m_strlen(filepart));
+ m_strcpy(filepart + m_strlen(filepart),
+ sizeof(filepart) - m_strlen(filepart), "/");
init = 1;
}
}
closedir (dirp);
if (dirpart[0]) {
- strfcpy (s, dirpart, slen);
+ m_strcpy(s, slen, dirpart);
if (m_strcmp("/", dirpart) != 0 && dirpart[0] != '='
&& dirpart[0] != '+')
- strfcpy (s + m_strlen(s), "/", slen - m_strlen(s));
- strfcpy (s + m_strlen(s), filepart, slen - m_strlen(s));
+ m_strcpy(s + m_strlen(s), slen - m_strlen(s), "/");
+ m_strcpy(s + m_strlen(s), slen - m_strlen(s), filepart);
}
else
- strfcpy (s, filepart, slen);
+ m_strcpy(s, slen, filepart);
return (init ? 0 : -1);
}
char pretty[_POSIX_PATH_MAX], msg[_POSIX_PATH_MAX + SHORT_STRING];
for (i = 0; i < idxlen; i++) {
- strfcpy (pretty, idx[i]->content->filename, sizeof (pretty));
+ m_strcpy(pretty, sizeof(pretty), idx[i]->content->filename);
if (stat (idx[i]->content->filename, &st) != 0) {
mutt_pretty_mailbox (pretty);
mutt_error (_("%s [#%d] no longer exists!"), pretty, i + 1);
case OP_COMPOSE_EDIT_NEWSGROUPS:
if (news) {
if (msg->env->newsgroups)
- strfcpy (buf, msg->env->newsgroups, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), msg->env->newsgroups);
else
buf[0] = 0;
if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) == 0
if (news) {
buf[0] = 0;
if (msg->env->followup_to)
- strfcpy (buf, msg->env->followup_to, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), msg->env->followup_to);
if (mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) == 0
&& buf[0]) {
p_delete(&msg->env->followup_to);
if (news && option (OPTXCOMMENTTO)) {
buf[0] = 0;
if (msg->env->x_comment_to)
- strfcpy (buf, msg->env->x_comment_to, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), msg->env->x_comment_to);
if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0
&& buf[0]) {
p_delete(&msg->env->x_comment_to);
#endif
case OP_COMPOSE_EDIT_SUBJECT:
if (msg->env->subject)
- strfcpy (buf, msg->env->subject, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), msg->env->subject);
else
buf[0] = 0;
if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) {
mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
case OP_COMPOSE_EDIT_FCC:
- strfcpy (buf, fcc, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), fcc);
if (mutt_get_field ("Fcc: ", buf, sizeof (buf), M_FILE | M_CLEAR) == 0) {
- strfcpy (fcc, buf, _POSIX_PATH_MAX);
+ m_strcpy(fcc, _POSIX_PATH_MAX, buf);
mutt_pretty_mailbox (fcc);
move (HDR_FCC, HDR_XOFFSET + SW);
mutt_paddstr (W, fcc);
if ((op == OP_COMPOSE_ATTACH_MESSAGE) ^ (Context->magic == M_NNTP))
#endif
{
- strfcpy (fname, NONULL (Context->path), sizeof (fname));
+ m_strcpy(fname, sizeof(fname), NONULL(Context->path));
mutt_pretty_mailbox (fname);
}
case OP_COMPOSE_EDIT_DESCRIPTION:
CHECK_COUNT;
- strfcpy (buf,
- idx[menu->current]->content->description ?
- idx[menu->current]->content->description : "", sizeof (buf));
+ m_strcpy(buf, sizeof(buf),
+ NONULL(idx[menu->current]->content->description));
/* header names should not be translated */
if (mutt_get_field ("Description: ", buf, sizeof (buf), 0) == 0) {
str_replace (&idx[menu->current]->content->description, buf);
case OP_COMPOSE_EDIT_ENCODING:
CHECK_COUNT;
- strfcpy (buf, ENCODING (idx[menu->current]->content->encoding),
- sizeof (buf));
+ m_strcpy(buf, sizeof(buf),
+ ENCODING(idx[menu->current]->content->encoding));
if (mutt_get_field ("Content-Transfer-Encoding: ", buf,
sizeof (buf), 0) == 0 && buf[0]) {
if ((i = mutt_check_encoding (buf)) != ENCOTHER && i != ENCUUENCODED) {
case OP_COMPOSE_RENAME_FILE:
CHECK_COUNT;
- strfcpy (fname, idx[menu->current]->content->filename, sizeof (fname));
+ m_strcpy(fname, sizeof(fname), idx[menu->current]->content->filename);
mutt_pretty_mailbox (fname);
if (mutt_get_field (_("Rename to: "), fname, sizeof (fname), M_FILE)
== 0 && fname[0]) {
fname[0] = '\0';
if (Context) {
- strfcpy (fname, NONULL (Context->path), sizeof (fname));
+ m_strcpy(fname, sizeof(fname), NONULL(Context->path));
mutt_pretty_mailbox (fname);
}
if (idxlen)
if (flags & M_CM_PREFIX) {
if (option (OPTTEXTFLOWED))
- strfcpy (prefix, ">", sizeof (prefix));
+ m_strcpy(prefix, sizeof(prefix), ">");
else
_mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix), Context,
hdr, 0);
but we know that this may only be text thus we assume Latin-1
here. */
if (!mutt_get_body_charset (body_charset, sizeof (body_charset), m))
- strfcpy (body_charset, "iso-8859-1", sizeof body_charset);
+ m_strcpy(body_charset, sizeof(body_charset), "iso-8859-1");
fseeko (s->fpin, m->offset, 0);
last_pos = m->offset;
for (l = id_defaults; l; l = l->next)
if (!m_strcasecmp(whatfor, l->what)) {
- strfcpy (resp, NONULL (l->dflt), sizeof (resp));
+ m_strcpy(resp, sizeof(resp), NONULL(l->dflt));
break;
}
}
if ((protocol_minor = strchr (protocol, '/')))
protocol_minor++;
- strfcpy (major, protocol, sizeof (major));
+ m_strcpy(major, sizeof(major), protocol);
if ((t = strchr (major, '/')))
*t = '\0';
break;
}
- strfcpy (buf, ref->data, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), ref->data);
}
if (!Context->id_hash)
Context->id_hash = mutt_make_id_hash (Context);
if (!Context->id_hash)
Context->id_hash = mutt_make_id_hash (Context);
- strfcpy (buf, CURHDR->env->message_id, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), CURHDR->env->message_id);
if (op == OP_RECONSTRUCT_THREAD) {
LIST *ref = CURHDR->env->references;
nntp_check_msgid (Context, ref->data);
/* the last msgid in References is the root message */
if (!ref->next)
- strfcpy (buf, ref->data, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), ref->data);
ref = ref->next;
}
}
set_option (OPTHIDEREAD);
}
else {
- strfcpy (buf, Context->pattern + 8, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), Context->pattern + 8);
if (!*buf || strncmp (buf, ".*", 2) == 0)
snprintf (buf, sizeof (buf), "~A");
unset_option (OPTHIDEREAD);
# define LONG_STRING 1024
# define MAXLOCKATTEMPT 5
-# define strfcpy(A,B,C) m_strcpy(A,C,B)
-
# ifdef USE_SETGID
# ifdef HAVE_SETEGID
#endif /* DL_STANDALONE */
+#include <lib-lib/str.h>
+
static int DotlockFlags;
static int Retry = MAXLOCKATTEMPT;
#define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0])
-size_t m_strlen(const char* s) {
- return (s ? strlen (s) : 0);
-}
-
int main (int argc, char **argv)
{
int i;
if (m_strlen(basename) + 1 > l)
return -1;
- strfcpy (bn, basename, l);
+ m_strcpy(bn, l, basename);
if (chdir (dirname) == -1)
return -1;
/* link is full path */
if (*link == '/') {
- strfcpy (newpath, link, _POSIX_PATH_MAX);
+ m_strcpy(newpath, _POSIX_PATH_MAX, link);
return;
}
if ((lb = strrchr (path, '/')) == NULL) {
/* no path in link */
- strfcpy (newpath, link, _POSIX_PATH_MAX);
+ m_strcpy(newpath, _POSIX_PATH_MAX, link);
return;
}
len = lb - path + 1;
memcpy (newpath, path, len);
- strfcpy (newpath + len, link, _POSIX_PATH_MAX - len);
+ m_strcpy(newpath + len, _POSIX_PATH_MAX - len, link);
}
linkfile[len] = '\0';
dotlock_expand_link (linkpath, pathptr, linkfile);
- strfcpy (realpath, linkpath, sizeof (realpath));
+ m_strcpy(realpath, sizeof(realpath), linkpath);
pathptr = realpath;
}
else
break;
}
- strfcpy (d, pathptr, l);
+ m_strcpy(d, l, pathptr);
return 0;
}
tmp[sizeof (tmp) - 1] = 0;
if (prefix) {
- strfcpy (tmp, NONULL (Prefix), sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), NONULL(Prefix));
tmplen = m_strlen(tmp);
p = tmp + tmplen;
tmplen = sizeof (tmp) - tmplen;
if (!e->subject || force) {
addstr ("Subject: ");
- strfcpy (tmp, e->subject ? e->subject : "", sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), NONULL(e->subject));
if (mutt_enter_string (tmp, sizeof (tmp), LINES - 1, 9, 0) == 0)
str_replace (&e->subject, tmp);
addch ('\n');
case 'u':
if (buflen) {
buflen--;
- strfcpy (tmp, buf[buflen], sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), buf[buflen]);
tmp[m_strlen(tmp) - 1] = 0;
p_delete(&buf[buflen]);
buf[buflen] = NULL;
if (q) {
strip_trailing_dot (q);
- strfcpy (s, q, l);
+ m_strcpy(s, l, q);
safe_fclose (&f);
return 0;
}
p_delete(&fname);
if (entry->command) {
- strfcpy (command, entry->command, sizeof (command));
+ m_strcpy(command, sizeof(command), entry->command);
/* rfc1524_expand_command returns 0 if the file is required */
piped =
else if (me && hdr->cc)
snprintf (buf, len, "Cc %s", mutt_get_name (hdr->cc));
else if (hdr->from)
- strfcpy (buf, mutt_get_name (hdr->from), len);
+ m_strcpy(buf, len, mutt_get_name(hdr->from));
else
*buf = 0;
}
else if (me && hdr->cc)
snprintf (buf, len, "%s", hdr->cc->mailbox);
else if (hdr->from)
- strfcpy (buf, hdr->from->mailbox, len);
+ m_strcpy(buf, len, hdr->from->mailbox);
else
*buf = 0;
}
!first_mailing_list (dest, destlen, hdr->env->cc))
dest[0] = 0;
if (dest[0]) {
- strfcpy (buf2, dest, sizeof (buf2));
+ m_strcpy(buf2, sizeof(buf2), dest);
mutt_format_s (dest, destlen, prefix, buf2);
break;
}
case 'b':
if (ctx) {
if ((p = strrchr (ctx->path, '/')))
- strfcpy (dest, p + 1, destlen);
+ m_strcpy(dest, destlen, p + 1);
else
- strfcpy (dest, ctx->path, destlen);
+ m_strcpy(dest, destlen, ctx->path);
}
else
- strfcpy (dest, "(null)", destlen);
- strfcpy (buf2, dest, sizeof (buf2));
+ m_strcpy(dest, destlen, "(null)");
+ m_strcpy(buf2, sizeof(buf2), dest);
mutt_format_s (dest, destlen, prefix, buf2);
break;
snprintf (dest, destlen, fmt, ctx->msgcount);
}
else
- strfcpy (dest, "(null)", destlen);
+ m_strcpy(dest, destlen, "(null)");
break;
case 'n':
case 'u':
if (hdr->env->from && hdr->env->from->mailbox) {
- strfcpy (buf2, mutt_addr_for_display (hdr->env->from), sizeof (buf2));
+ m_strcpy(buf2, sizeof(buf2), mutt_addr_for_display(hdr->env->from));
if ((p = strpbrk (buf2, "%@")))
*p = 0;
}
p = cur->data + 4;
SKIPWS (p);
if (*p) {
- strfcpy (fcc, p, fcclen);
+ m_strcpy(fcc, fcclen, p);
mutt_pretty_mailbox (fcc);
}
keep = 0;
SKIPWS (q);
}
else
- strfcpy (path, p, sizeof (path));
+ m_strcpy(path, sizeof(path), p);
mutt_expand_path (path, sizeof (path));
if ((body = mutt_make_file_attach (path))) {
body->description = m_strdup(q);
mutt_extract_token (&pattern, s, 0);
if (!MoreArgs (s)) {
- strfcpy (err->data, _("too few arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("too few arguments"));
goto error;
}
M_ACCOUNTHOOK | M_REPLYHOOK)) ? M_TOKEN_SPACE : 0);
if (!command.data) {
- strfcpy (err->data, _("too few arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("too few arguments"));
goto error;
}
if (MoreArgs (s)) {
- strfcpy (err->data, _("too many arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("too many arguments"));
goto error;
}
if (data & (M_FOLDERHOOK | M_MBOXHOOK)) {
- strfcpy (path, pattern.data, sizeof (path));
+ m_strcpy(path, sizeof(path), pattern.data);
_mutt_expand_path (path, sizeof (path), 1);
p_delete(&pattern.data);
p_clear(&pattern, 1);
#ifdef USE_COMPRESSED
else if (data & (M_APPENDHOOK | M_OPENHOOK | M_CLOSEHOOK)) {
if (mutt_test_compress_command (command.data)) {
- strfcpy (err->data, _("bad formatted command string"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("bad formatted command string"));
return (-1);
}
}
) {
char tmp[HUGE_STRING];
- strfcpy (tmp, pattern.data, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), pattern.data);
mutt_check_simple (tmp, sizeof (tmp), DefaultHook);
p_delete(&pattern.data);
p_clear(&pattern, 1);
}
if (data & (M_MBOXHOOK | M_SAVEHOOK | M_FCCHOOK)) {
- strfcpy (path, command.data, sizeof (path));
+ m_strcpy(path, sizeof(path), command.data);
mutt_expand_path (path, sizeof (path));
p_delete(&command.data);
p_clear(&command, 1);
mutt_safe_path (buf, sizeof (buf), adr);
mutt_concat_path(path, pathlen, NONULL(Maildir), buf);
if (!option (OPTFORCENAME) && mx_access (path, W_OK) != 0)
- strfcpy (path, NONULL (Outbox), pathlen);
+ m_strcpy(path, pathlen, NONULL(Outbox));
}
else
- strfcpy (path, NONULL (Outbox), pathlen);
+ m_strcpy(path, pathlen, NONULL(Outbox));
}
mutt_pretty_mailbox (path);
}
MD5Init (&ctx);
MD5Update (&ctx, (unsigned char *) password, secret_len);
MD5Final (hash_passwd, &ctx);
- strfcpy ((char *) secret, (char *) hash_passwd, MD5_DIGEST_LEN);
+ m_strcpy((char *)secret, MD5_DIGEST_LEN, (char *)hash_passwd);
secret_len = MD5_DIGEST_LEN;
}
else
- strfcpy ((char *) secret, password, sizeof (secret));
+ m_strcpy((char *)secret, sizeof(secret), password);
p_clear(ipad, 1);
p_clear(opad, 1);
}
if (irc == IMAP_CMD_RESPOND) {
- strfcpy (buf + olen, "\r\n", sizeof (buf) - olen);
+ m_strcpy(buf + olen, sizeof(buf) - olen, "\r\n");
mutt_socket_write (idata->conn, buf);
}
save_lsub = option (OPTIMAPCHECKSUBSCRIBED);
unset_option (OPTIMAPCHECKSUBSCRIBED);
- strfcpy (list_cmd, option (OPTIMAPLSUB) ? "LSUB" : "LIST",
- sizeof (list_cmd));
+ m_strcpy(list_cmd, sizeof(list_cmd),
+ option(OPTIMAPLSUB) ? "LSUB" : "LIST");
if (!(idata = imap_conn_find (&(mx.account), 0)))
goto fail;
goto fail;
}
- strfcpy (buf, NONULL (mx.mbox), sizeof (buf));
+ m_strcpy(buf, sizeof(buf), NONULL(mx.mbox));
/* append a delimiter if necessary */
n = m_strlen(buf);
/* render superiors as unix-standard ".." */
if (isparent)
- strfcpy (relpath, "../", sizeof (relpath));
+ m_strcpy(relpath, sizeof(relpath), "../");
/* strip current folder from target, to render a relative path */
else if (!m_strncmp(mx.mbox, folder, m_strlen(mx.mbox)))
- strfcpy (relpath, folder + m_strlen(mx.mbox), sizeof (relpath));
+ m_strcpy(relpath, sizeof(relpath), folder + m_strlen(mx.mbox));
else
- strfcpy (relpath, folder, sizeof (relpath));
+ m_strcpy(relpath, sizeof(relpath), folder);
/* apply filemask filter. This should really be done at menu setup rather
* than at scan, since it's so expensive to scan. But that's big changes
imap_unmunge_mbox_name (s);
debug_print (2, ("Subscribing to %s\n", s));
- strfcpy (buf, "mailboxes \"", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), "mailboxes \"");
mutt_account_tourl (&idata->conn->account, &url);
url.path = s;
if (!m_strcmp(url.user, ImapUser))
p_delete(&mx.mbox);
imap_munge_mbox_name (mbox, sizeof (mbox), buf);
- strfcpy (mbox_unquoted, buf, sizeof (mbox_unquoted));
+ m_strcpy(mbox_unquoted, sizeof(mbox_unquoted), buf);
/* The draft IMAP implementor's guide warns againts using the STATUS
* command on a mailbox that you have selected
if (m_strcmp(mbox_unquoted, idata->mailbox) == 0
|| (ascii_strcasecmp (mbox_unquoted, "INBOX") == 0
&& m_strcasecmp(mbox_unquoted, idata->mailbox) == 0)) {
- strfcpy (buf, "NOOP", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), "NOOP");
}
else if (mutt_bit_isset (idata->capabilities, IMAP4REV1) ||
mutt_bit_isset (idata->capabilities, STATUS)) {
mailbox = (BUFFY*) Incoming->data[i];
if (!m_strncmp(dest, mailbox->path, matchlen)) {
if (rc) {
- strfcpy (dest, mailbox->path, len);
+ m_strcpy(dest, len, mailbox->path);
rc = 0;
} else
longest_common_prefix (dest, mailbox->path, matchlen, len);
url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0);
if (!m_strncmp(dest, urlstr, matchlen)) {
if (rc) {
- strfcpy (dest, urlstr, len);
+ m_strcpy(dest, len, urlstr);
rc = 0;
} else
longest_common_prefix (dest, urlstr, matchlen, len);
IMAP_MBOX mx;
if (imap_parse_path (path, &mx) || !mx.mbox) {
- strfcpy (dest, path, dlen);
+ m_strcpy(dest, dlen, path);
return imap_complete_hosts (dest, dlen);
}
* known mailboxes/hooks/etc */
if (!(idata = imap_conn_find (&(mx.account), M_IMAP_CONN_NONEW))) {
p_delete(&mx.mbox);
- strfcpy (dest, path, dlen);
+ m_strcpy(dest, dlen, path);
return imap_complete_hosts (dest, dlen);
}
conn = idata->conn;
imap_cmd_start (idata, buf);
/* and see what the results are */
- strfcpy (completion, NONULL (mx.mbox), sizeof (completion));
+ m_strcpy(completion, sizeof(completion), NONULL(mx.mbox));
do {
if (imap_parse_list_response (idata, &list_word, &noselect, &noinferiors,
&delim))
}
/* copy in first word */
if (!completions) {
- strfcpy (completion, list_word, sizeof (completion));
+ m_strcpy(completion, sizeof(completion), list_word);
matchlen = m_strlen(completion);
completions++;
continue;
int x = 0;
if (!mailbox || !*mailbox) {
- strfcpy (path, "INBOX", plen);
+ m_strcpy(path, plen, "INBOX");
return path;
}
}
path[0] = '\0';
- strfcpy (path, val, sizeof(path));
+ m_strcpy(path, sizeof(path), val);
mutt_expand_path (path, sizeof(path));
str_replace ((char **) dst->data, path);
return (1);
/* Insist on at least one parameter */
if (!MoreArgs (s)) {
if (data == M_SPAM)
- strfcpy (err->data, _("spam: no matching pattern"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("spam: no matching pattern"));
else
- strfcpy (err->data, _("nospam: no matching pattern"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("nospam: no matching pattern"));
return -1;
}
}
/* This should not happen. */
- strfcpy (err->data, "This is no good at all.", err->dsize);
+ m_strcpy(err->data, err->dsize, "This is no good at all.");
return -1;
}
mutt_extract_token(buf, s, 0);
if (!buf->data || *buf->data == '\0') {
- strfcpy(err->data, _("attachments: no disposition"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("attachments: no disposition"));
return -1;
}
else
listp = &InlineExclude;
} else {
- strfcpy(err->data, _("attachments: invalid disposition"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("attachments: invalid disposition"));
return -1;
}
mutt_extract_token(buf, s, 0);
if (!buf->data || *buf->data == '\0') {
- strfcpy(err->data, _("unattachments: no disposition"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("unattachments: no disposition"));
return -1;
}
listp = &InlineExclude;
}
else {
- strfcpy(err->data, _("unattachments: invalid disposition"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("unattachments: invalid disposition"));
return -1;
}
char *estr = NULL;
if (!MoreArgs (s)) {
- strfcpy (err->data, _("alias: no address"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("alias: no address"));
return (-1);
}
mutt_extract_token (buf, s, M_TOKEN_SPACE | M_TOKEN_QUOTE);
if ((p = strpbrk (buf->data, ": \t")) == NULL || *p != ':') {
- strfcpy (err->data, _("invalid header field"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("invalid header field"));
return (-1);
}
keylen = p - buf->data + 1;
return (-1);
}
- strfcpy (path, tmp->data, sizeof(path));
+ m_strcpy(path, sizeof(path), tmp->data);
mutt_expand_path (path, sizeof(path));
rc += source_rc (path, err);
if (strstr (src, try) == src) {
Matches[Num_matched++] = src;
if (dest[0] == 0)
- strfcpy (dest, src, len);
+ m_strcpy(dest, len, src);
else {
for (l = 0; src[l] && src[l] == dest[l]; l++);
dest[l] = 0;
/* first TAB. Collect all the matches */
if (numtabs == 1) {
Num_matched = 0;
- strfcpy (User_typed, pt, sizeof(User_typed));
+ m_strcpy(User_typed, sizeof(User_typed), pt);
p_clear(Matches, sizeof(Matches));
p_clear(Completed, sizeof(Completed));
for (num = 0; Commands[num].name; num++)
/* first TAB. Collect all the matches */
if (numtabs == 1) {
Num_matched = 0;
- strfcpy (User_typed, pt, sizeof(User_typed));
+ m_strcpy(User_typed, sizeof(User_typed), pt);
p_clear(Matches, sizeof(Matches));
p_clear(Completed, sizeof(Completed));
for (num = 0; MuttVars[num].option; num++)
/* first TAB. Collect all the matches */
if (numtabs == 1) {
Num_matched = 0;
- strfcpy (User_typed, pt, sizeof(User_typed));
+ m_strcpy(User_typed, sizeof(User_typed), pt);
p_clear(Matches, sizeof(Matches));
p_clear(Completed, sizeof(Completed));
for (num = 0; menu[num].name; num++)
return 0;
if (m_strncmp(buffer, "set", 3) == 0) {
- strfcpy (var, pt, sizeof(var));
+ m_strcpy(var, sizeof(var), pt);
/* ignore the trailing '=' when comparing */
var[m_strlen(var) - 1] = 0;
if (!(option = hash_find (ConfigOptions, var)))
if ((DTYPE (option->type) == DT_STR) ||
(DTYPE (option->type) == DT_PATH) ||
(DTYPE (option->type) == DT_RX)) {
- strfcpy (tmp, NONULL (*((char **) option->data)), sizeof(tmp));
+ m_strcpy(tmp, sizeof(tmp), NONULL(*((char **)option->data)));
if (DTYPE (option->type) == DT_PATH)
mutt_pretty_mailbox (tmp);
}
*((ADDRESS **) option->data), 0);
}
else if (DTYPE (option->type) == DT_QUAD)
- strfcpy (tmp, vals[quadoption (option->data)], sizeof(tmp));
+ m_strcpy(tmp, sizeof(tmp), vals[quadoption(option->data)]);
else if (DTYPE (option->type) == DT_NUM)
snprintf (tmp, sizeof(tmp), "%d", (*((short *) option->data)));
else if (DTYPE (option->type) == DT_SORT) {
default:
p = "unknown";
}
- strfcpy (tmp, p, sizeof(tmp));
+ m_strcpy(tmp, sizeof(tmp), p);
}
else if (DTYPE (option->type) == DT_BOOL)
- strfcpy (tmp, option (option->data) ? "yes" : "no",
- sizeof(tmp));
+ m_strcpy(tmp, sizeof(tmp), option(option->data) ? "yes" : "no");
else
return 0;
}
*d = '\0';
- strfcpy (tmp, pt, sizeof(tmp));
+ m_strcpy(tmp, sizeof(tmp), pt);
snprintf (pt, dlen, "%s\"%s\"", tmp, tmp2);
return 1;
if ((p = strchr (utsname.nodename, '.'))) {
Hostname = str_substrdup (utsname.nodename, p);
p++;
- strfcpy (buffer, p, sizeof(buffer)); /* save the domain for below */
+ m_strcpy(buffer, sizeof(buffer), p); /* save the domain for below */
}
else
Hostname = m_strdup(utsname.nodename);
Muttrc = m_strdup(buffer);
}
else {
- strfcpy (buffer, Muttrc, sizeof(buffer));
+ m_strcpy(buffer, sizeof(buffer), Muttrc);
p_delete(&Muttrc);
mutt_expand_path (buffer, sizeof(buffer));
Muttrc = m_strdup(buffer);
char c;
char *s, *t;
- strfcpy (buff, str, sizeof (buff));
+ m_strcpy(buff, sizeof(buff), str);
s = buff;
while (*s && len) {
return (0);
for (;;) {
- strfcpy (s, km_keyname (map->keys[p]), len);
+ m_strcpy(s, len, km_keyname(map->keys[p]));
len -= (l = m_strlen(s));
if (++p >= map->len || !len)
mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
if (MoreArgs (s)) {
- strfcpy (err->data, _("push: too many arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("push: too many arguments"));
r = -1;
}
else
mutt_extract_token (&buf, s, 0);
if (!*buf.data) {
- strfcpy (err->data, _("null key sequence"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("null key sequence"));
}
else if (MoreArgs (s))
return (buf.data);
}
else {
- strfcpy (err->data, _("too few arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("too few arguments"));
}
error:
p_delete(&buf.data);
/* function to execute */
mutt_extract_token (buf, s, 0);
if (MoreArgs (s)) {
- strfcpy (err->data, _("bind: too many arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("bind: too many arguments"));
r = -1;
}
else if (ascii_strcasecmp ("noop", buf->data) == 0) {
mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
/* make sure the macro sequence is not an empty string */
if (!*buf->data) {
- strfcpy (err->data, _("macro: empty key sequence"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("macro: empty key sequence"));
}
else {
if (MoreArgs (s)) {
mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
if (MoreArgs (s)) {
- strfcpy (err->data, _("macro: too many arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("macro: too many arguments"));
}
else {
for (i = 0; i < nummenus; ++i) {
char *function;
if (!MoreArgs (s)) {
- strfcpy (err->data, _("exec: no arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("exec: no arguments"));
return (-1);
}
#define NONULL(x) (x?x:"")
+static inline int m_strisempty(const char *s) {
+ return !s || !*s;
+}
+
static inline ssize_t m_strlen(const char *s) {
return s ? strlen(s) : 0;
}
# define ISSPACE(c) isspace((unsigned char)c)
# define ISBLANK(c) (c == ' ' || c == '\t')
-# define strfcpy(A,B,C) m_strcpy(A,C,B)
/* this macro must check for *c == 0 since isspace(0) has
* unreliable behavior on some systems */
# define SKIPWS(c) while (*(c) && isspace ((unsigned char) *(c))) c++;
break;
case 'f':
- strfcpy (folder, optarg, sizeof (folder));
+ m_strcpy(folder, sizeof(folder), optarg);
explicit_folder = 1;
break;
char fpath[_POSIX_PATH_MAX];
char msg[STRING];
- strfcpy (fpath, Maildir, sizeof (fpath));
+ m_strcpy(fpath, sizeof(fpath), Maildir);
mutt_expand_path (fpath, sizeof (fpath));
#ifdef USE_IMAP
/* we're not connected yet - skip mail folder creation */
else {
char path[_POSIX_PATH_MAX];
- strfcpy (path, infile, sizeof (path));
+ m_strcpy(path, sizeof(path), infile);
mutt_expand_path (path, sizeof (path));
if ((fin = fopen (path, "r")) == NULL) {
if (!option (OPTNOCURSES))
}
if (!folder[0])
- strfcpy (folder, NONULL (Spoolfile), sizeof (folder));
+ m_strcpy(folder, sizeof(folder), NONULL(Spoolfile));
#ifdef USE_NNTP
if (option (OPTNEWS)) {
char buf[SHORT_STRING];
if (op != OP_SEARCH_NEXT && op != OP_SEARCH_OPPOSITE) {
- strfcpy (buf, menu->searchBuf ? menu->searchBuf : "", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), NONULL(menu->searchBuf));
if (mutt_get_field ((op == OP_SEARCH) ? _("Search for: ") :
_("Reverse search for: "),
buf, sizeof (buf), M_CLEAR) != 0 || !buf[0])
if (stat (buf, &st) == 0)
ctx->mtime_cur = st.st_mtime;
- strfcpy (buf, ctx->path, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), ctx->path);
}
if (stat (buf, &st) == 0)
is_old = (m_strcmp("cur", subdir) == 0);
}
else
- strfcpy (buf, ctx->path, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), ctx->path);
if ((dirp = opendir (buf)) == NULL)
return -1;
*suffix = '\0';
if (hdr && (hdr->read || hdr->old))
- strfcpy (subdir, "cur", sizeof (subdir));
+ m_strcpy(subdir, sizeof(subdir), "cur");
else
- strfcpy (subdir, "new", sizeof (subdir));
+ m_strcpy(subdir, sizeof(subdir), "new");
for (;;) {
snprintf (path, _POSIX_PATH_MAX, "%s/tmp/%s.%ld.%u_%d.%s%s",
/* extract the subdir */
s = strrchr (msg->path, '/') + 1;
- strfcpy (subdir, s, 4);
+ m_strcpy(subdir, sizeof(subdir), s);
/* extract the flags */
if ((s = strchr (s, ':')))
- strfcpy (suffix, s, sizeof (suffix));
+ m_strcpy(suffix, sizeof(suffix), s);
else
suffix[0] = '\0';
if ((rc = mutt_copy_message (dest->fp, ctx, h,
M_CM_UPDATE, CH_UPDATE | CH_UPDATE_LEN)) == 0)
{
- snprintf (oldpath, _POSIX_PATH_MAX, "%s/%s", ctx->path, h->path);
- strfcpy (partpath, h->path, _POSIX_PATH_MAX);
+ snprintf (oldpath, sizeof(oldpath), "%s/%s", ctx->path, h->path);
+ m_strcpy(partpath, sizeof(partpath), h->path);
if (ctx->magic == M_MAILDIR)
rc = maildir_commit_message (dest, ctx, h);
return (-1);
}
p++;
- strfcpy (newpath, p, sizeof (newpath));
+ m_strcpy(newpath, sizeof(newpath), p);
/* kill the previous flags */
if ((p = strchr (newpath, ':')) != NULL)
if ((t = strrchr (src, '/')))
src = t + 1;
- strfcpy (dest, src, l);
+ m_strcpy(dest, l, src);
if ((u = strrchr (dest, ':')))
*u = '\0';
if (!option (OPTCHECKNEW))
return 0;
- strfcpy (buf, ctx->path, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), ctx->path);
if (stat (buf, &st) == -1)
return -1;
static char ret[SHORT_STRING];
char *c, *c2;
- strfcpy (ret, _("Unknown"), sizeof (ret));
+ m_strcpy(ret, sizeof(ret), _("Unknown"));
c = strstr (line, ndx);
if (c) {
c2 = strchr (c, '/');
if (c2)
*c2 = '\0';
- strfcpy (ret, c, sizeof (ret));
+ m_strcpy(ret, sizeof(ret), c);
if (c2)
*c2 = '/';
}
static char buf[64];
BIO *bio;
- strfcpy (buf, _("[invalid date]"), sizeof (buf));
+ m_strcpy(buf, sizeof(buf), _("[invalid date]"));
bio = BIO_new (BIO_s_mem ());
if (bio) {
menu->dialog[i] = p_new(char, SHORT_STRING);
row = 0;
- strfcpy (menu->dialog[row], _("This certificate belongs to:"),
- SHORT_STRING);
+ m_strcpy(menu->dialog[row], SHORT_STRING,
+ _("This certificate belongs to:"));
row++;
name = X509_NAME_oneline (X509_get_subject_name (data->cert),
buf, sizeof (buf));
}
row++;
- strfcpy (menu->dialog[row], _("This certificate was issued by:"),
- SHORT_STRING);
+ m_strcpy(menu->dialog[row], SHORT_STRING,
+ _("This certificate was issued by:"));
row++;
name = X509_NAME_oneline (X509_get_issuer_name (data->cert),
buf, sizeof (buf));
Weekdays[l->tm_wday], l->tm_mday, Months[l->tm_mon],
l->tm_year + 1900, l->tm_hour, l->tm_min, l->tm_sec);
else
- strfcpy (s, _("[invalid date]"), len);
+ m_strcpy(s, len, _("[invalid date]"));
return (s);
}
menu->dialog[i] = p_new(char, SHORT_STRING);
row = 0;
- strfcpy (menu->dialog[row], _("This certificate belongs to:"),
- SHORT_STRING);
+ m_strcpy(menu->dialog[row], SHORT_STRING,
+ _("This certificate belongs to:"));
row++;
buflen = sizeof (dn_common_name);
dn_province, dn_country);
row++;
- strfcpy (menu->dialog[row], _("This certificate was issued by:"),
- SHORT_STRING);
+ m_strcpy(menu->dialog[row], SHORT_STRING,
+ _("This certificate was issued by:"));
row++;
buflen = sizeof (dn_common_name);
if (certerr_notyetvalid) {
row++;
- strfcpy (menu->dialog[row],
- _("WARNING: Server certificate is not yet valid"), SHORT_STRING);
+ m_strcpy(menu->dialog[row], SHORT_STRING,
+ _("WARNING: Server certificate is not yet valid"));
}
if (certerr_expired) {
row++;
- strfcpy (menu->dialog[row], _("WARNING: Server certificate has expired"),
- SHORT_STRING);
+ m_strcpy(menu->dialog[row], SHORT_STRING,
+ _("WARNING: Server certificate has expired"));
}
if (certerr_revoked) {
row++;
- strfcpy (menu->dialog[row],
- _("WARNING: Server certificate has been revoked"), SHORT_STRING);
+ m_strcpy(menu->dialog[row], SHORT_STRING,
+ _("WARNING: Server certificate has been revoked"));
}
if (certerr_hostname) {
row++;
- strfcpy (menu->dialog[row],
- _("WARNING: Server hostname does not match certificate"),
- SHORT_STRING);
+ m_strcpy(menu->dialog[row], SHORT_STRING,
+ _("WARNING: Server hostname does not match certificate"));
}
if (certerr_signernotca) {
row++;
- strfcpy (menu->dialog[row],
- _("WARNING: Signer of server certificate is not a CA"),
- SHORT_STRING);
+ m_strcpy(menu->dialog[row], SHORT_STRING,
+ _("WARNING: Signer of server certificate is not a CA"));
}
menu->title = _("TLS/SSL Certificate check");
size_t sl;
struct stat sb;
- strfcpy (buf, dir && *dir ? dir : NONULL (Tempdir), sizeof (buf));
+ m_strcpy(buf, sizeof(buf), m_strisempty(dir) ? NONULL(Tempdir) : dir);
mutt_expand_path (buf, sizeof (buf));
if (s[0] == '\0') {
snprintf (s, l, "%s/muttXXXXXX", buf);
mktemp (s);
}
else {
- strfcpy (tmp, s, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), s);
mutt_sanitize_filename (tmp, 1);
snprintf (s, l, "%s/%s", buf, tmp);
if (lstat (s, &sb) == -1 && errno == ENOENT)
if (period != NULL) {
*period = '.';
sl = m_strlen(s);
- strfcpy (s + sl, period, l - sl);
+ m_strcpy(s + sl, l - sl, period);
}
}
}
if (src->filename) {
use_disp = 1;
- strfcpy (tmp, src->filename, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), src->filename);
}
else {
use_disp = 0;
/* lnk is full path */
if (*lnk == '/') {
- strfcpy (newpath, lnk, _POSIX_PATH_MAX);
+ m_strcpy(newpath, _POSIX_PATH_MAX, lnk);
return;
}
if ((lb = strrchr (path, '/')) == NULL) {
/* no path in lnk */
- strfcpy (newpath, lnk, _POSIX_PATH_MAX);
+ m_strcpy(newpath, _POSIX_PATH_MAX, lnk);
return;
}
len = lb - path + 1;
memcpy (newpath, path, len);
- strfcpy (newpath + len, lnk, _POSIX_PATH_MAX - len);
+ m_strcpy(newpath + len, _POSIX_PATH_MAX - len, lnk);
}
char *mutt_expand_path (char *s, size_t slen)
case '~':
{
if (*(s + 1) == '/' || *(s + 1) == 0) {
- strfcpy (p, NONULL (Homedir), sizeof (p));
+ m_strcpy(p, sizeof(p), NONULL(Homedir));
tail = s + 1;
}
else {
*t = 0;
if ((pw = getpwnam (s + 1))) {
- strfcpy (p, pw->pw_dir, sizeof (p));
+ m_strcpy(p, sizeof(p), pw->pw_dir);
if (t) {
*t = '/';
tail = t;
/* if folder = imap[s]://host/: don't append slash */
if (imap_is_magic (NONULL (Maildir), NULL) == M_IMAP &&
Maildir[m_strlen(Maildir) - 1] == '/')
- strfcpy (p, NONULL (Maildir), sizeof (p));
+ m_strcpy(p, sizeof(p), NONULL(Maildir));
else
#endif
snprintf (p, sizeof (p), "%s/", NONULL (Maildir));
case '>':
{
- strfcpy (p, NONULL (Inbox), sizeof (p));
+ m_strcpy(p, sizeof(p), NONULL(Inbox));
tail = s + 1;
}
break;
case '<':
{
- strfcpy (p, NONULL (Outbox), sizeof (p));
+ m_strcpy(p, sizeof(p), NONULL(Outbox));
tail = s + 1;
}
break;
case '!':
{
if (*(s + 1) == '!') {
- strfcpy (p, NONULL (LastFolder), sizeof (p));
+ m_strcpy(p, sizeof(p), NONULL(LastFolder));
tail = s + 2;
}
else {
- strfcpy (p, NONULL (Spoolfile), sizeof (p));
+ m_strcpy(p, sizeof(p), NONULL(Spoolfile));
tail = s + 1;
}
}
case '-':
{
- strfcpy (p, NONULL (LastFolder), sizeof (p));
+ m_strcpy(p, sizeof(p), NONULL(LastFolder));
tail = s + 1;
}
break;
case '^':
{
- strfcpy (p, NONULL (CurrentFolder), sizeof (p));
+ m_strcpy(p, sizeof(p), NONULL(CurrentFolder));
tail = s + 1;
}
break;
else
snprintf (tmp, sizeof (tmp), "%s%s", p, tail);
- strfcpy (s, tmp, slen);
+ m_strcpy(s, slen, tmp);
}
while (recurse);
if (GecosMask.rx) {
if (regexec (GecosMask.rx, pw->pw_gecos, 1, pat_match, 0) == 0)
- strfcpy (dest, pw->pw_gecos + pat_match[0].rm_so,
- MIN (pat_match[0].rm_eo - pat_match[0].rm_so + 1, destlen));
+ m_strcpy(dest, MIN(pat_match[0].rm_eo - pat_match[0].rm_so + 1, destlen),
+ pw->pw_gecos + pat_match[0].rm_so);
}
else if ((p = strchr (pw->pw_gecos, ',')))
- strfcpy (dest, pw->pw_gecos, MIN (destlen, p - pw->pw_gecos + 1));
+ m_strcpy(dest, MIN(destlen, p - pw->pw_gecos + 1), pw->pw_gecos);
else
- strfcpy (dest, pw->pw_gecos, destlen);
+ m_strcpy(dest, destlen, pw->pw_gecos);
pwnl = m_strlen(pw->pw_name);
void mutt_pretty_size (char *s, size_t len, long n)
{
if (n == 0)
- strfcpy (s, "0K", len);
+ m_strcpy(s, len, "0K");
else if (n < 10189) /* 0.1K - 9.9K */
snprintf (s, len, "%3.1fK", (n < 103) ? 0.1 : n / 1024.0);
else if (n < 1023949) { /* 10K - 999K */
break;
case 's':
found = 1;
- strfcpy (d, src, destlen + 1);
+ m_strcpy(d, destlen + 1, src);
d += destlen > slen ? slen : destlen;
destlen -= destlen > slen ? slen : destlen;
p++;
char tmp[_POSIX_PATH_MAX];
struct stat st;
- strfcpy (fname, path, flen);
+ m_strcpy(fname, flen, path);
if (access (fname, F_OK) != 0)
return 0;
if (stat (fname, &st) != 0)
void mutt_save_path (char *d, size_t dsize, ADDRESS * a)
{
if (a && a->mailbox) {
- strfcpy (d, a->mailbox, dsize);
+ m_strcpy(d, dsize, a->mailbox);
if (!option (OPTSAVEADDRESS)) {
char *p;
if ((p = mutt_find_hook (M_MBOXHOOK, ctx->path))) {
isSpool = 1;
- strfcpy (mbox, p, sizeof (mbox));
+ m_strcpy(mbox, sizeof(mbox), p);
}
else {
- strfcpy (mbox, NONULL (Inbox), sizeof (mbox));
+ m_strcpy(mbox, sizeof(mbox), NONULL(Inbox));
isSpool = mutt_is_spool (ctx->path) && !mutt_is_spool (mbox);
}
mutt_expand_path (mbox, sizeof (mbox));
km_find_func (MENU_MAIN, OP_TOGGLE_WRITE)))
snprintf (tmp, sizeof (tmp), _(" Press '%s' to toggle write"), buf);
else
- strfcpy (tmp, _("Use 'toggle-write' to re-enable write!"),
- sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), _("Use 'toggle-write' to re-enable write!"));
mutt_error (_("Mailbox is marked unwritable. %s"), tmp);
return -1;
len = p + 1 - line;
if (len > sizeof (group))
len = sizeof (group);
- strfcpy (group, line, len);
+ m_strcpy(group, len, line);
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, group)) == NULL) {
data = xmalloc(sizeof(NNTP_DATA) + m_strlen(group) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
if (!NewsCacheDir || !*NewsCacheDir)
return 0;
- strfcpy (dir, NewsCacheDir, sizeof (dir));
+ m_strcpy(dir, sizeof(dir), NewsCacheDir);
mutt_expand_path (dir, sizeof (dir));
if (lstat (dir, &st) || (st.st_mode & S_IFDIR) == 0) {
*group = '\0';
if (url.path)
- strfcpy (group, url.path, group_len);
+ m_strcpy(group, group_len, url.path);
ret = mutt_account_fromurl (acct, &url);
}
data->firstMessage, data->lastLoaded);
}
else {
- strfcpy (file, serv->cache, sizeof (file));
+ m_strcpy(file, sizeof(file), serv->cache);
snprintf (buf, sizeof (buf), "ALL %s 0 %d", file,
(int) serv->newgroups_time);
}
f = safe_fopen (file, "w");
}
else {
- strfcpy (buf, news->conn->account.host, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), news->conn->account.host);
f = mutt_mkname (buf);
news->cache = m_strdup(buf);
nntp_cache_expand (file, buf);
return -1;
} while (!done);
- strfcpy (line, buf, linelen);
+ m_strcpy(line, linelen, buf);
return 0;
}
int ret;
do {
- strfcpy (buf, query, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), query);
if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
return -1;
if (buf[0] == '5')
p++;
}
- strfcpy (inbuf + lenbuf, p, sizeof (buf));
+ m_strcpy(inbuf + lenbuf, sizeof(buf), p);
pos += chunk;
if (chunk >= sizeof (buf)) {
return -1;
}
- strfcpy (buf, "POST\r\n", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), "POST\r\n");
if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
mutt_error (_("Can't post article. Connection to %s lost."),
nntp_data->nserv->conn->account.host);
return -1;
}
- strfcpy (msg, _("Loading descriptions..."), sizeof (msg));
+ m_strcpy(msg, sizeof(msg), _("Loading descriptions..."));
mutt_message (msg);
nntp_get_desc (&nntp_data, "*", msg, NULL);
mutt_compile_help (helpstr, sizeof (helpstr), MENU_PAGER, PagerHelp);
if (IsHeader (extra)) {
- strfcpy (tmphelp, helpstr, sizeof (tmphelp));
+ m_strcpy(tmphelp, sizeof(tmphelp), helpstr);
mutt_compile_help (buffer, sizeof (buffer), MENU_PAGER,
#ifdef USE_NNTP
(Context
snprintf (helpstr, sizeof (helpstr), "%s %s", tmphelp, buffer);
}
if (!InHelp) {
- strfcpy (tmphelp, helpstr, sizeof (tmphelp));
+ m_strcpy(tmphelp, sizeof(tmphelp), helpstr);
mutt_make_help (buffer, sizeof (buffer), _("Help"), MENU_PAGER, OP_HELP);
snprintf (helpstr, sizeof (helpstr), "%s %s", tmphelp, buffer);
}
case OP_SEARCH:
case OP_SEARCH_REVERSE:
- strfcpy (buffer, searchbuf, sizeof (buffer));
+ m_strcpy(buffer, sizeof(buffer), searchbuf);
if (mutt_get_field ((SearchBack ? _("Reverse search: ") :
_("Search: ")), buffer, sizeof (buffer),
M_CLEAR) != 0)
if (!buffer[0])
break;
- strfcpy (searchbuf, buffer, sizeof (searchbuf));
+ m_strcpy(searchbuf, sizeof(searchbuf), buffer);
/* leave SearchBack alone if ch == OP_SEARCH_NEXT */
if (ch == OP_SEARCH)
* the date format imposes a natural limit.
*/
- strfcpy (scratch, s, sizeof (scratch));
+ m_strcpy(scratch, sizeof(scratch), s);
/* kill the day of the week, if it exists. */
if ((t = strchr (scratch, ',')))
char tmp[HUGE_STRING];
char *r;
- strfcpy (tmp, s, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), s);
r = tmp;
while ((r = strtok (r, " \t")) != NULL) {
p = rfc822_parse_adrlist (p, r);
p_clear(&buffer, 1);
if (mutt_extract_token (&buffer, s, M_TOKEN_COMMENT | M_TOKEN_PATTERN) != 0
|| !buffer.data) {
- strfcpy (err->data, _("error in expression"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("error in expression"));
return (-1);
}
}
}
if (!curlist) {
- strfcpy (err->data, _("empty pattern"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("empty pattern"));
return NULL;
}
if (curlist->next) {
if (!strchr (s, '~') && !strchr (s, '=')) { /* yup, so spoof a real request */
/* convert old tokens into the new format */
if (ascii_strcasecmp ("all", s) == 0 || !m_strcmp("^", s) || !m_strcmp(".", s)) /* ~A is more efficient */
- strfcpy (s, "~A", len);
+ m_strcpy(s, len, "~A");
else if (ascii_strcasecmp ("del", s) == 0)
- strfcpy (s, "~D", len);
+ m_strcpy(s, len, "~D");
else if (ascii_strcasecmp ("flag", s) == 0)
- strfcpy (s, "~F", len);
+ m_strcpy(s, len, "~F");
else if (ascii_strcasecmp ("new", s) == 0)
- strfcpy (s, "~N", len);
+ m_strcpy(s, len, "~N");
else if (ascii_strcasecmp ("old", s) == 0)
- strfcpy (s, "~O", len);
+ m_strcpy(s, len, "~O");
else if (ascii_strcasecmp ("repl", s) == 0)
- strfcpy (s, "~Q", len);
+ m_strcpy(s, len, "~Q");
else if (ascii_strcasecmp ("read", s) == 0)
- strfcpy (s, "~R", len);
+ m_strcpy(s, len, "~R");
else if (ascii_strcasecmp ("tag", s) == 0)
- strfcpy (s, "~T", len);
+ m_strcpy(s, len, "~T");
else if (ascii_strcasecmp ("unread", s) == 0)
- strfcpy (s, "~U", len);
+ m_strcpy(s, len, "~U");
else {
quote_simple (tmp, sizeof (tmp), s);
mutt_expand_fmt (s, len, simple, tmp);
BUFFER err;
int i;
- strfcpy (buf, NONULL (Context->pattern), sizeof (buf));
+ m_strcpy(buf, sizeof(buf), NONULL(Context->pattern));
if (prompt || op != M_LIMIT)
if (mutt_get_field (prompt, buf, sizeof (buf), M_PATTERN | M_CLEAR) != 0 || !buf[0])
return (-1);
HEADER *h;
if (op != OP_SEARCH_NEXT && op != OP_SEARCH_OPPOSITE) {
- strfcpy (buf, LastSearch, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), LastSearch);
if (mutt_get_field ((op == OP_SEARCH) ? _("Search for: ") :
_("Reverse search for: "), buf, sizeof (buf),
M_CLEAR | M_PATTERN) != 0 || !buf[0])
/* compare the *expanded* version of the search pattern in case
$simple_search has changed while we were searching */
- strfcpy (temp, buf, sizeof (temp));
+ m_strcpy(temp, sizeof(temp), buf);
mutt_check_simple (temp, sizeof (temp), NONULL (SimpleSearch));
if (!SearchPattern || m_strcmp(temp, LastSearchExpn)) {
set_option (OPTSEARCHINVALID);
- strfcpy (LastSearch, buf, sizeof (LastSearch));
+ m_strcpy(LastSearch, sizeof(LastSearch), buf);
mutt_message _("Compiling search pattern...");
mutt_pattern_free (&SearchPattern);
for (l = id_defaults; l; l = l->next)
if (!m_strcasecmp(whatfor, l->what)) {
- strfcpy (resp, NONULL (l->dflt), sizeof (resp));
+ m_strcpy(resp, sizeof(resp), NONULL(l->dflt));
break;
}
}
}
if (_kring)
- strfcpy (kring, _kring, sizeof (kring));
+ m_strcpy(kring, sizeof(kring), _kring);
else {
if ((env_pgppath = getenv ("PGPPATH")))
- strfcpy (pgppath, env_pgppath, sizeof (pgppath));
+ m_strcpy(pgppath, sizeof(pgppath), env_pgppath);
else if ((env_home = getenv ("HOME")))
snprintf (pgppath, sizeof (pgppath), "%s/.pgp", env_home);
else {
}
if (ret == PQ_OK) {
- strfcpy (buf, "QUIT\r\n", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), "QUIT\r\n");
ret = pop_query (pop_data, buf, sizeof (buf));
}
mutt_message _("Checking for new messages...");
/* find out how many messages are in the mailbox. */
- strfcpy (buffer, "STAT\r\n", sizeof (buffer));
+ m_strcpy(buffer, sizeof(buffer), "STAT\r\n");
ret = pop_query (pop_data, buffer, sizeof (buffer));
if (ret == PQ_NOT_CONNECTED)
goto fail;
/* only get unread messages */
if (msgs > 0 && option (OPTPOPLAST)) {
- strfcpy (buffer, "LAST\r\n", sizeof (buffer));
+ m_strcpy(buffer, sizeof(buffer), "LAST\r\n");
ret = pop_query (pop_data, buffer, sizeof (buffer));
if (ret == PQ_NOT_CONNECTED)
goto fail;
if (rset) {
/* make sure no messages get deleted */
- strfcpy (buffer, "RSET\r\n", sizeof (buffer));
+ m_strcpy(buffer, sizeof(buffer), "RSET\r\n");
if (pop_query (pop_data, buffer, sizeof (buffer)) == PQ_NOT_CONNECTED)
goto fail;
}
finish:
/* exit gracefully */
- strfcpy (buffer, "QUIT\r\n", sizeof (buffer));
+ m_strcpy(buffer, sizeof(buffer), "QUIT\r\n");
if (pop_query (pop_data, buffer, sizeof (buffer)) == PQ_NOT_CONNECTED)
goto fail;
mutt_socket_close (conn);
/* looping protocol */
for (;;) {
- strfcpy (buf + olen, "\r\n", sizeof (buf) - olen);
+ m_strcpy(buf + olen, sizeof(buf) - olen, "\r\n");
mutt_socket_write (pop_data->conn, buf);
if (mutt_socket_readln (inbuf, sizeof (inbuf), pop_data->conn) < 0) {
sasl_dispose (&saslconn);
c = c2;
}
- strfcpy (t, c, sizeof (pop_data->err_msg) - strlen (pop_data->err_msg));
+ m_strcpy(t, sizeof(pop_data->err_msg) - strlen(pop_data->err_msg), c);
str_skip_trailws (pop_data->err_msg);
}
/* Execute CAPA command */
if (mode == 0 || pop_data->cmd_capa != CMD_NOT_AVAILABLE) {
- strfcpy (buf, "CAPA\r\n", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), "CAPA\r\n");
switch (pop_fetch_data (pop_data, buf, NULL, fetch_capa, pop_data)) {
case PQ_OK:
{
pop_data->cmd_uidl = CMD_UNKNOWN;
pop_data->cmd_top = CMD_UNKNOWN;
- strfcpy (buf, "AUTH\r\n", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), "AUTH\r\n");
if (pop_fetch_data (pop_data, buf, NULL, fetch_auth, pop_data) == PQ_NOT_CONNECTED)
return PQ_NOT_CONNECTED;
}
pop_data->use_stls = 2;
}
if (pop_data->use_stls == 2) {
- strfcpy (buf, "STLS\r\n", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), "STLS\r\n");
ret = pop_query (pop_data, buf, sizeof (buf));
if (ret == PQ_NOT_CONNECTED)
goto err_conn;
}
/* get total size of mailbox */
- strfcpy (buf, "STAT\r\n", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), "STAT\r\n");
ret = pop_query (pop_data, buf, sizeof (buf));
if (ret == PQ_NOT_CONNECTED)
goto err_conn;
mutt_message _("Closing connection to POP server...");
if (ctx->readonly) {
- strfcpy (buf, "RSET\r\n", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), "RSET\r\n");
ret = pop_query (pop_data, buf, sizeof (buf));
}
if (ret != PQ_NOT_CONNECTED) {
- strfcpy (buf, "QUIT\r\n", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), "QUIT\r\n");
pop_query (pop_data, buf, sizeof (buf));
}
long pos = 0;
size_t lenbuf = 0;
- strfcpy (buf, query, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), query);
ret = pop_query (pop_data, buf, sizeof (buf));
if (ret != PQ_OK)
return ret;
p++;
}
- strfcpy(inbuf + lenbuf, p, sizeof(buf));
+ m_strcpy(inbuf + lenbuf,sizeof(buf), p);
pos += chunk;
if (chunk >= sizeof (buf)) {
else if (ascii_strncasecmp ("X-Mutt-Fcc:", tmp->data, 11) == 0) {
p = tmp->data + 11;
SKIPWS (p);
- strfcpy (fcc, p, fcclen);
+ m_strcpy(fcc, fcclen, p);
mutt_pretty_mailbox (fcc);
/* remove the X-Mutt-Fcc: header field */
file[0] = '\0';
if (b->filename) {
- strfcpy (file, b->filename, sizeof (file));
+ m_strcpy(file, sizeof(file), b->filename);
b->d_filename = m_strdup(b->filename);
}
else {
if (aptr->content->filename && *aptr->content->filename == '/') {
char path[_POSIX_PATH_MAX];
- strfcpy (path, aptr->content->filename, sizeof (path));
+ m_strcpy(path, sizeof(path), aptr->content->filename);
mutt_pretty_mailbox (path);
mutt_format_s (dest, destlen, prefix, path);
}
mutt_concat_path(buf, sizeof(buf), *directory,
mutt_basename(body->filename));
else
- strfcpy (buf, body->filename, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), body->filename);
}
else if (body->hdr &&
body->encoding != ENCBASE64 &&
char tmpbuf[_POSIX_PATH_MAX];
snprintf (tmpbuf, sizeof (tmpbuf), "%s%s", LastSaveFolder, buf);
- strfcpy (buf, tmpbuf, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), tmpbuf);
ret = mutt_get_field (_("Save to file: ")
, buf, sizeof (buf), M_FILE);
if ((ret != 0) || (!buf[0]))
}
else {
mutt_extract_path (buf, path);
- strfcpy (LastSaveFolder, path, sizeof (LastSaveFolder));
+ m_strcpy(LastSaveFolder, sizeof(LastSaveFolder), path);
}
prompt = NULL;
}
else if (rc == -1)
return -1;
- strfcpy (tfile, buf, sizeof (tfile));
+ m_strcpy(tfile, sizeof(tfile), buf);
}
else {
if ((rc =
if (!buf[0]) {
int append = 0;
- strfcpy (buf, NONULL (top->filename), sizeof (buf));
+ m_strcpy(buf, sizeof(buf), NONULL(top->filename));
if (mutt_get_field (_("Save to file: "), buf, sizeof (buf),
M_FILE | M_CLEAR) != 0 || !buf[0])
return;
p = (cur || count_tagged (idx, idxlen) == 1);
if (p)
- strfcpy (prompt, _("Bounce message to: "), sizeof (prompt));
+ m_strcpy(prompt, sizeof(prompt), _("Bounce message to: "));
else
- strfcpy (prompt, _("Bounce tagged messages to: "), sizeof (prompt));
+ m_strcpy(prompt, sizeof(prompt), _("Bounce tagged messages to: "));
buf[0] = '\0';
if (mutt_get_field (prompt, buf, sizeof (buf), M_ALIAS)
if (quote) {
if (_prefix)
- strfcpy (prefix, _prefix, sizeof (prefix));
+ m_strcpy(prefix, sizeof(prefix), _prefix);
else if (!option (OPTTEXTFLOWED))
_mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix),
Context, hdr, 0);
else
- strfcpy (prefix, ">", sizeof (prefix));
+ m_strcpy(prefix, sizeof(prefix), ">");
chflags |= CH_PREFIX;
}
_mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix), Context,
parent, 0);
else
- strfcpy (prefix, ">", sizeof (prefix));
+ m_strcpy(prefix, sizeof(prefix), ">");
}
include_header (option (OPTFORWQUOTE), fp, parent, tmpfp, prefix);
_mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix),
Context, parent, 0);
else
- strfcpy (prefix, ">", sizeof (prefix));
+ m_strcpy(prefix, sizeof(prefix), ">");
st.prefix = prefix;
st.flags = M_CHARCONV;
snprintf (cmd, sizeof (cmd), "cat %s | %s -m ", tempfile, Mixmaster);
for (i = 0; chain; chain = chain->next, i = 1) {
- strfcpy (tmp, cmd, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), cmd);
mutt_quote_filename (cd_quoted, sizeof (cd_quoted), (char *) chain->data);
snprintf (cmd, sizeof (cmd), "%s%s%s", tmp, i ? "," : " -l ", cd_quoted);
}
char buf[LONG_STRING];
char type[LONG_STRING];
- strfcpy (type, _type, sizeof (type));
+ m_strcpy(type, sizeof(type), _type);
if (option (OPTMAILCAPSANITIZE))
mutt_sanitize_filename (type, 0);
param[z] = '\0';
_pvalue = mutt_get_parameter (param, a->parameter);
- strfcpy (pvalue, NONULL (_pvalue), sizeof (pvalue));
+ m_strcpy(pvalue, sizeof(pvalue), NONULL(_pvalue));
if (option (OPTMAILCAPSANITIZE))
mutt_sanitize_filename (pvalue, 0);
buf[y++] = command[x++];
}
buf[y] = '\0';
- strfcpy (command, buf, clen);
+ m_strcpy(command, clen, buf);
return needspipe;
}
{
if (len > siz)
len = siz - 1;
- strfcpy (d, s, len);
+ m_strcpy(d, len, s);
}
int rfc1524_expand_filename (char *nametemplate,
if (!nametemplate) {
if (oldfile)
- strfcpy (newfile, oldfile, nflen);
+ m_strcpy(newfile, nflen, oldfile);
}
else if (!oldfile) {
mutt_expand_fmt (newfile, nflen, nametemplate, "mutt");
if (rmatch)
*right = 0;
else
- strfcpy (right, nametemplate + i + 2, sizeof (right));
+ m_strcpy(right, sizeof(right), nametemplate + i + 2);
snprintf (newfile, nflen, "%s%s%s", left, oldfile, right);
}
else {
/* no "%s" in the name template. */
- strfcpy (newfile, nametemplate, nflen);
+ m_strcpy(newfile, nflen, nametemplate);
}
}
if (charset)
mutt_convert_string (&d0, charset, Charset, M_ICONV_HOOK_FROM);
- strfcpy (d, d0, len);
+ m_strcpy(d, len, d0);
p_delete(&charset);
p_delete(&d0);
return (0);
}
*t = '\0';
- strfcpy (charset, value, chslen);
+ m_strcpy(charset, chslen, value);
if ((u = strchr (t + 1, '\'')))
return u + 1;
value = NULL;
l = 0;
- strfcpy (attribute, par->attribute, sizeof (attribute));
+ m_strcpy(attribute, sizeof(attribute), par->attribute);
if ((encoded = par->encoded))
valp = rfc2231_get_charset (par->value, charset, sizeof (charset));
}
*pc++ = '"';
*pc = 0;
- strfcpy (buf, tmp, buflen);
+ m_strcpy(buf, buflen, tmp);
}
else
- strfcpy (buf, value, buflen);
+ m_strcpy(buf, buflen, value);
}
void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr,
else {
if (!buflen)
goto done;
- strfcpy (pbuf, addr->personal, buflen);
+ m_strcpy(pbuf, buflen, addr->personal);
len = m_strlen(pbuf);
pbuf += len;
buflen -= len;
if (!buflen)
goto done;
if (ascii_strcmp (addr->mailbox, "@") && !display) {
- strfcpy (pbuf, addr->mailbox, buflen);
+ m_strcpy(pbuf, buflen, addr->mailbox);
len = m_strlen(pbuf);
}
else if (ascii_strcmp (addr->mailbox, "@") && display) {
- strfcpy (pbuf, mutt_addr_for_display (addr), buflen);
+ m_strcpy(pbuf, buflen, mutt_addr_for_display(addr));
len = m_strlen(pbuf);
}
else {
mutt_extract_token (buf, s, 0);
if (!MoreArgs (s)) {
- strfcpy (err->data, _("score: too few arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("score: too few arguments"));
return (-1);
}
pattern = buf->data;
mutt_extract_token (buf, s, 0);
if (MoreArgs (s)) {
p_delete(&pattern);
- strfcpy (err->data, _("score: too many arguments"), err->dsize);
+ m_strcpy(err->data, err->dsize, _("score: too many arguments"));
return (-1);
}
#ifdef USE_NNTP
if (option (OPTNEWSSEND)) {
if (en->newsgroups)
- strfcpy (buf, en->newsgroups, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), en->newsgroups);
else
buf[0] = 0;
if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) != 0)
en->newsgroups = m_strdup(buf);
if (en->followup_to)
- strfcpy (buf, en->followup_to, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), en->followup_to);
else
buf[0] = 0;
if (option (OPTASKFOLLOWUP)
en->followup_to = m_strdup(buf);
if (en->x_comment_to)
- strfcpy (buf, en->x_comment_to, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), en->x_comment_to);
else
buf[0] = 0;
if (option (OPTXCOMMENTTO) && option (OPTASKXCOMMENTTO)
if (option (OPTFASTREPLY))
return (0);
else
- strfcpy (buf, en->subject, sizeof (buf));
+ m_strcpy(buf, sizeof(buf), en->subject);
}
else {
char *p;
/* Escape lines that begin with/only contain "the message separator". */
if (linelen == 4 && !m_strncmp("From", line, 4)) {
- strfcpy (line, "=46rom", sizeof (line));
+ m_strcpy(line, sizeof(line), "=46rom");
linelen = 6;
}
else if (linelen == 4 && !m_strncmp("from", line, 4)) {
- strfcpy (line, "=66rom", sizeof (line));
+ m_strcpy(line, sizeof(line), "=66rom");
linelen = 6;
}
else if (linelen == 1 && line[0] == '.') {
- strfcpy (line, "=2E", sizeof (line));
+ m_strcpy(line, sizeof(line), "=2E");
linelen = 3;
}
return (-1);
}
- strfcpy (boundary, p, sizeof (boundary));
+ m_strcpy(boundary, sizeof(boundary), p);
for (t = a->parts; t; t = t->next) {
fprintf (f, "\n--%s\n", boundary);
snprintf (buf, sizeof (buf), "%s/.mime.types", NONULL (Homedir));
break;
case 1:
- strfcpy (buf, SYSCONFDIR "/muttng-mime.types", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), SYSCONFDIR "/muttng-mime.types");
break;
case 2:
- strfcpy (buf, PKGDATADIR "/mime.types", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), PKGDATADIR "/mime.types");
break;
case 3:
- strfcpy (buf, SYSCONFDIR "/mime.types", sizeof (buf));
+ m_strcpy(buf, sizeof(buf), SYSCONFDIR "/mime.types");
break;
default:
debug_print (1, ("Internal error, count = %d.\n", count));
str_substrcpy (subtype, p, q, sizeof (subtype));
if ((type = mutt_check_mime_type (ct)) == TYPEOTHER)
- strfcpy (xtype, ct, sizeof (xtype));
+ m_strcpy(xtype, sizeof(xtype), ct);
cur_sze = sze;
}
if (p)
mutt_canonical_charset (d, dlen, NONULL (p));
else
- strfcpy (d, "us-ascii", dlen);
+ m_strcpy(d, dlen, "us-ascii");
return d;
}
char buf1[LONG_STRING], buf2[LONG_STRING];
struct stat sb;
- strfcpy (path, NONULL (SmimeCALocation), sizeof (path));
+ m_strcpy(path, sizeof(path), NONULL(SmimeCALocation));
mutt_expand_path (path, sizeof (path));
mutt_quote_filename (buf1, sizeof (buf1), path);
continue;
}
else if (choice == M_YES) {
- strfcpy (key, fields[1], sizeof (key));
+ m_strcpy(key, sizeof(key), fields[1]);
ask = 0;
break;
}
else {
if (public)
key_trust_level = *fields[4];
- strfcpy (key, fields[1], sizeof (key));
+ m_strcpy(key, sizeof(key), fields[1]);
}
found = 1;
}
if (numFields >= 3 &&
!(m_strncasecmp(query, fields[2], query_len))) {
ask = 0;
- strfcpy (key, fields[1], sizeof (key));
+ m_strcpy(key, sizeof(key), fields[1]);
}
/* query = certificate: return intermediate certificate. */
else if (numFields >= 4 &&
!(m_strncasecmp(query, fields[1], query_len))) {
ask = 0;
- strfcpy (key, fields[3], sizeof (key));
+ m_strcpy(key, sizeof(key), fields[3]);
}
}
#ifdef USE_COMPRESSED
if (Context && Context->compressinfo && Context->realpath) {
if ((p = strrchr (Context->realpath, '/')))
- strfcpy (tmp, p + 1, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), p + 1);
else
- strfcpy (tmp, Context->realpath, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), Context->realpath);
}
else
#endif
if (Context && Context->path) {
if ((p = strrchr (Context->path, '/')))
- strfcpy (tmp, p + 1, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), p + 1);
else
- strfcpy (tmp, Context->path, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), Context->path);
}
else
- strfcpy (tmp, _("no mailbox"), sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), _("no mailbox"));
snprintf (buf, buflen, fmt, tmp);
break;
snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
#ifdef USE_COMPRESSED
if (Context && Context->compressinfo && Context->realpath) {
- strfcpy (tmp, Context->realpath, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), Context->realpath);
mutt_pretty_mailbox (tmp);
}
else
#endif
if (Context && Context->path) {
- strfcpy (tmp, Context->path, sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), Context->path);
mutt_pretty_mailbox (tmp);
}
else
- strfcpy (tmp, _("(no mailbox)"), sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), _("(no mailbox)"));
snprintf (buf, buflen, fmt, tmp);
break;
new_tree = p_new(char, (2 + depth * width));
if (start_depth > 1) {
memcpy(new_tree, pfx, (start_depth - 1) * width);
- strfcpy (new_tree + (start_depth - 1) * width,
- arrow, (1 + depth - start_depth) * width + 2);
+ m_strcpy(new_tree + (start_depth - 1) * width,
+ (1 + depth - start_depth) * width + 2, arrow);
}
else
- strfcpy (new_tree, arrow, 2 + depth * width);
+ m_strcpy(new_tree, 2 + depth * width, arrow);
tree->message->tree = new_tree;
}
}
if ((t - s) + 1 >= sizeof (sbuf))
return U_UNKNOWN;
- strfcpy (sbuf, s, t - s + 1);
+ m_strcpy(sbuf, t - s + 1, s);
for (t = sbuf; *t; t++)
*t = ascii_tolower (*t);
else if (!ascii_strncasecmp (src, "file://", 7)) /* we don't support remote files */
return -1;
else
- strfcpy (d, src + 5, dl);
+ m_strcpy(d, dl, src + 5);
url_pct_decode (d);
return 0;