void mutt_set_langinfo_charset(void)
{
- char buff[LONG_STRING];
- char buff2[LONG_STRING];
+ char buf[LONG_STRING];
+ char buf2[LONG_STRING];
- mutt_str_strfcpy(buff, nl_langinfo(CODESET), sizeof(buff));
- mutt_canonical_charset(buff2, sizeof(buff2), buff);
+ mutt_str_strfcpy(buf, nl_langinfo(CODESET), sizeof(buf));
+ mutt_canonical_charset(buf2, sizeof(buf2), buf);
/* finally, set $charset */
- Charset = mutt_str_strdup(buff2);
+ Charset = mutt_str_strdup(buf2);
if (!Charset)
Charset = mutt_str_strdup("iso-8859-1");
}
#ifdef HAVE_COLOR
-int mutt_parse_color(struct Buffer *buff, struct Buffer *s, unsigned long data,
+int mutt_parse_color(struct Buffer *buf, struct Buffer *s, unsigned long data,
struct Buffer *err)
{
bool dry_run = false;
if (option(OPT_NO_CURSES) || !has_colors())
dry_run = true;
- return parse_color(buff, s, err, parse_color_pair, dry_run);
+ return parse_color(buf, s, err, parse_color_pair, dry_run);
}
#endif
-int mutt_parse_mono(struct Buffer *buff, struct Buffer *s, unsigned long data,
+int mutt_parse_mono(struct Buffer *buf, struct Buffer *s, unsigned long data,
struct Buffer *err)
{
bool dry_run = false;
dry_run = true;
#endif
- return parse_color(buff, s, err, parse_attr_spec, dry_run);
+ return parse_color(buf, s, err, parse_attr_spec, dry_run);
}
extern int optind;
-#define BUFFSIZE 2048
+#define BUFSIZE 2048
/**
* enum OutputFormats - Documentation output formats
return D_INIT;
}
-static int commit_buff(char *buff, char **d, FILE *out, int docstat)
+static int commit_buf(char *buf, char **d, FILE *out, int docstat)
{
- if (*d > buff)
+ if (*d > buf)
{
**d = '\0';
- docstat = print_it(SP_STR, buff, out, docstat);
- *d = buff;
+ docstat = print_it(SP_STR, buf, out, docstat);
+ *d = buf;
}
return docstat;
static int handle_docline(char *l, FILE *out, int docstat)
{
- char buff[BUFFSIZE];
+ char buf[BUFSIZE];
char *s = NULL, *d = NULL;
l = skip_ws(l);
else if (strncmp(l, ". ", 2) == 0)
*l = ' ';
- for (s = l, d = buff; *s; s++)
+ for (s = l, d = buf; *s; s++)
{
if (strncmp(s, "\\(as", 4) == 0)
{
}
else if (strncmp(s, "\\fI", 3) == 0)
{
- docstat = commit_buff(buff, &d, out, docstat);
+ docstat = commit_buf(buf, &d, out, docstat);
docstat = print_it(SP_START_EM, NULL, out, docstat);
s += 2;
}
else if (strncmp(s, "\\fB", 3) == 0)
{
- docstat = commit_buff(buff, &d, out, docstat);
+ docstat = commit_buf(buf, &d, out, docstat);
docstat = print_it(SP_START_BF, NULL, out, docstat);
s += 2;
}
else if (strncmp(s, "\\fC", 3) == 0)
{
- docstat = commit_buff(buff, &d, out, docstat);
+ docstat = commit_buf(buf, &d, out, docstat);
docstat = print_it(SP_START_TT, NULL, out, docstat);
s += 2;
}
else if (strncmp(s, "\\fP", 3) == 0)
{
- docstat = commit_buff(buff, &d, out, docstat);
+ docstat = commit_buf(buf, &d, out, docstat);
docstat = print_it(SP_END_FT, NULL, out, docstat);
s += 2;
}
{
if (docstat & D_DD)
{
- docstat = commit_buff(buff, &d, out, docstat);
+ docstat = commit_buf(buf, &d, out, docstat);
docstat = print_it(SP_END_DD, NULL, out, docstat);
}
- docstat = commit_buff(buff, &d, out, docstat);
+ docstat = commit_buf(buf, &d, out, docstat);
docstat = print_it(SP_DT, NULL, out, docstat);
s += 3;
}
{
if ((docstat & D_IL) && (docstat & D_DD))
{
- docstat = commit_buff(buff, &d, out, docstat);
+ docstat = commit_buf(buf, &d, out, docstat);
docstat = print_it(SP_END_DD, NULL, out, docstat);
}
- docstat = commit_buff(buff, &d, out, docstat);
+ docstat = commit_buf(buf, &d, out, docstat);
docstat = print_it(SP_DD, NULL, out, docstat);
s += 3;
}
while (isalnum((unsigned char) *s) || (*s && strchr("-_<>", *s)))
s++;
- docstat = commit_buff(buff, &d, out, docstat);
+ docstat = commit_buf(buf, &d, out, docstat);
save = *s;
*s = '\0';
print_ref(out, output_dollar, ref);
*d++ = *s;
}
- docstat = commit_buff(buff, &d, out, docstat);
+ docstat = commit_buf(buf, &d, out, docstat);
return print_it(SP_NEWLINE, NULL, out, docstat);
}
{ NULL, NULL },
};
-static int buff2type(const char *s)
+static int buf_to_type(const char *s)
{
for (int type = DT_NONE; types[type].machine; type++)
if (strcmp(types[type].machine, s) == 0)
static void conf_char_to_escape(unsigned int c, FILE *out)
{
- char buff[16];
- char_to_escape(buff, c);
- fputs(buff, out);
+ char buf[16];
+ char_to_escape(buf, c);
+ fputs(buf, out);
}
static void conf_print_strval(const char *v, FILE *out)
static void sgml_print_strval(const char *v, FILE *out)
{
- char buff[16];
+ char buf[16];
for (; *v; v++)
{
if (*v < ' ' || *v & 0x80)
{
- char_to_escape(buff, (unsigned int) *v);
- sgml_fputs(buff, out);
+ char_to_escape(buf, (unsigned int) *v);
+ sgml_fputs(buf, out);
continue;
}
sgml_fputc((unsigned int) *v, out);
static void handle_confline(char *s, FILE *out)
{
- char varname[BUFFSIZE];
- char buff[BUFFSIZE];
- char tmp[BUFFSIZE];
+ char varname[BUFSIZE];
+ char buf[BUFSIZE];
+ char tmp[BUFSIZE];
int type;
- char val[BUFFSIZE];
+ char val[BUFSIZE];
/* xxx - put this into an actual state machine? */
return;
/* comma */
- s = get_token(buff, sizeof(buff), s);
+ s = get_token(buf, sizeof(buf), s);
if (!s)
return;
/* type */
- s = get_token(buff, sizeof(buff), s);
+ s = get_token(buf, sizeof(buf), s);
if (!s)
return;
- type = buff2type(buff);
+ type = buf_to_type(buf);
/* possibly a "|" or comma */
- s = get_token(buff, sizeof(buff), s);
+ s = get_token(buf, sizeof(buf), s);
if (!s)
return;
- if (strcmp(buff, "|") == 0)
+ if (strcmp(buf, "|") == 0)
{
if (Debug)
fprintf(stderr, "%s: Expecting <subtype> <comma>.\n", Progname);
/* ignore subtype and comma */
- s = get_token(buff, sizeof(buff), s);
+ s = get_token(buf, sizeof(buf), s);
if (!s)
return;
- s = get_token(buff, sizeof(buff), s);
+ s = get_token(buf, sizeof(buf), s);
if (!s)
return;
}
while (true)
{
- s = get_token(buff, sizeof(buff), s);
+ s = get_token(buf, sizeof(buf), s);
if (!s)
return;
- if (strcmp(buff, ",") == 0)
+ if (strcmp(buf, ",") == 0)
break;
}
/* option name or UL &address */
- s = get_token(buff, sizeof(buff), s);
+ s = get_token(buf, sizeof(buf), s);
if (!s)
return;
- if (strcmp(buff, "UL") == 0)
+ if (strcmp(buf, "UL") == 0)
{
- s = get_token(buff, sizeof(buff), s);
+ s = get_token(buf, sizeof(buf), s);
if (!s)
return;
}
/* comma */
- s = get_token(buff, sizeof(buff), s);
+ s = get_token(buf, sizeof(buf), s);
if (!s)
return;
fprintf(stderr, "%s: Expecting default value.\n", Progname);
/* <default value> or UL <default value> */
- s = get_token(buff, sizeof(buff), s);
+ s = get_token(buf, sizeof(buf), s);
if (!s)
return;
- if (strcmp(buff, "UL") == 0)
+ if (strcmp(buf, "UL") == 0)
{
if (Debug)
fprintf(stderr, "%s: Skipping UL.\n", Progname);
- s = get_token(buff, sizeof(buff), s);
+ s = get_token(buf, sizeof(buf), s);
if (!s)
return;
}
do
{
- if (strcmp(buff, "}") == 0)
+ if (strcmp(buf, "}") == 0)
break;
- strncpy(tmp + strlen(tmp), buff, sizeof(tmp) - strlen(tmp));
- } while ((s = get_token(buff, sizeof(buff), s)));
+ strncpy(tmp + strlen(tmp), buf, sizeof(tmp) - strlen(tmp));
+ } while ((s = get_token(buf, sizeof(buf), s)));
pretty_default(val, sizeof(val), tmp, type);
print_confline(varname, type, val, out);
static void makedoc(FILE *in, FILE *out)
{
- char buffer[BUFFSIZE];
- char token[BUFFSIZE];
+ char buffer[BUFSIZE];
+ char token[BUFSIZE];
char *p = NULL;
int active = 0;
int line = 0;
static int edit_or_view_one_message(bool edit, struct Context *ctx, struct Header *cur)
{
char tmp[_POSIX_PATH_MAX];
- char buff[STRING];
+ char buf[STRING];
int omagic;
int oerrno;
int rc;
of = 0;
cf = ((tmpctx.magic == MUTT_MBOX || tmpctx.magic == MUTT_MMDF) ? 0 : CH_NOSTATUS);
- if (fgets(buff, sizeof(buff), fp) && is_from(buff, NULL, 0, NULL))
+ if (fgets(buf, sizeof(buf), fp) && is_from(buf, NULL, 0, NULL))
{
if (tmpctx.magic == MUTT_MBOX || tmpctx.magic == MUTT_MMDF)
cf = CH_FROM | CH_FORCE_FROM;
wchar_t *buffer;
wchar_t *line;
wchar_t *param;
- size_t buff_len;
+ size_t buf_len;
size_t line_len;
size_t line_used;
size_t line_max;
size_t indent_len;
size_t word_len;
- size_t buff_used;
+ size_t buf_used;
size_t param_used;
size_t param_len;
int tag_level[RICH_LAST_TAG];
(stte->wrap_margin - (stte->tag_level[RICH_INDENT_RIGHT] * INDENT_SIZE) - stte->indent_len)))
enriched_wrap(stte);
- if (stte->buff_used)
+ if (stte->buf_used)
{
- stte->buffer[stte->buff_used] = (wchar_t) '\0';
- stte->line_used += stte->buff_used;
+ stte->buffer[stte->buf_used] = (wchar_t) '\0';
+ stte->line_used += stte->buf_used;
if (stte->line_used > stte->line_max)
{
stte->line_max = stte->line_used;
wcscat(stte->line, stte->buffer);
stte->line_len += stte->word_len;
stte->word_len = 0;
- stte->buff_used = 0;
+ stte->buf_used = 0;
}
if (wrap)
enriched_wrap(stte);
}
/* see if more space is needed (plus extra for possible rich characters) */
- if (stte->buff_len < stte->buff_used + 3)
+ if (stte->buf_len < stte->buf_used + 3)
{
- stte->buff_len += LONG_STRING;
- mutt_mem_realloc(&stte->buffer, (stte->buff_len + 1) * sizeof(wchar_t));
+ stte->buf_len += LONG_STRING;
+ mutt_mem_realloc(&stte->buffer, (stte->buf_len + 1) * sizeof(wchar_t));
}
if ((!stte->tag_level[RICH_NOFILL] && iswspace(c)) || c == (wchar_t) '\0')
else
stte->word_len++;
- stte->buffer[stte->buff_used++] = c;
+ stte->buffer[stte->buf_used++] = c;
enriched_flush(stte, 0);
}
else
{
if (stte->tag_level[RICH_BOLD])
{
- stte->buffer[stte->buff_used++] = c;
- stte->buffer[stte->buff_used++] = (wchar_t) '\010';
- stte->buffer[stte->buff_used++] = c;
+ stte->buffer[stte->buf_used++] = c;
+ stte->buffer[stte->buf_used++] = (wchar_t) '\010';
+ stte->buffer[stte->buf_used++] = c;
}
else if (stte->tag_level[RICH_UNDERLINE])
{
- stte->buffer[stte->buff_used++] = '_';
- stte->buffer[stte->buff_used++] = (wchar_t) '\010';
- stte->buffer[stte->buff_used++] = c;
+ stte->buffer[stte->buf_used++] = '_';
+ stte->buffer[stte->buf_used++] = (wchar_t) '\010';
+ stte->buffer[stte->buf_used++] = c;
}
else if (stte->tag_level[RICH_ITALIC])
{
- stte->buffer[stte->buff_used++] = c;
- stte->buffer[stte->buff_used++] = (wchar_t) '\010';
- stte->buffer[stte->buff_used++] = '_';
+ stte->buffer[stte->buf_used++] = c;
+ stte->buffer[stte->buf_used++] = (wchar_t) '\010';
+ stte->buffer[stte->buf_used++] = '_';
}
else
{
- stte->buffer[stte->buff_used++] = c;
+ stte->buffer[stte->buf_used++] = c;
}
}
else
{
- stte->buffer[stte->buff_used++] = c;
+ stte->buffer[stte->buf_used++] = c;
}
stte->word_len++;
}
{
const char *c = NULL;
- if (stte->buff_len < stte->buff_used + mutt_str_strlen(s))
+ if (stte->buf_len < stte->buf_used + mutt_str_strlen(s))
{
- stte->buff_len += LONG_STRING;
- mutt_mem_realloc(&stte->buffer, (stte->buff_len + 1) * sizeof(wchar_t));
+ stte->buf_len += LONG_STRING;
+ mutt_mem_realloc(&stte->buffer, (stte->buf_len + 1) * sizeof(wchar_t));
}
c = s;
while (*c)
{
- stte->buffer[stte->buff_used++] = (wchar_t) *c;
+ stte->buffer[stte->buf_used++] = (wchar_t) *c;
c++;
}
}
static int parsekeys(const char *str, keycode_t *d, int max)
{
int n, len = max;
- char buff[SHORT_STRING];
+ char buf[SHORT_STRING];
char c;
char *s = NULL, *t = NULL;
- mutt_str_strfcpy(buff, str, sizeof(buff));
- s = buff;
+ mutt_str_strfcpy(buf, str, sizeof(buf));
+ s = buf;
while (*s && len)
{
{
FILE *fp = NULL;
int line = 1;
- char *buff = NULL;
+ char *buf = NULL;
char *t = NULL;
size_t sz = 0;
if (!fp)
return 0; /* yes, ask callers to silently ignore the error */
- while ((buff = mutt_file_read_line(buff, &sz, fp, &line, 0)))
+ while ((buf = mutt_file_read_line(buf, &sz, fp, &line, 0)))
{
- t = strtok(buff, " \t:");
+ t = strtok(buf, " \t:");
if (!t)
continue;
rc = 0;
out:
- FREE(&buff);
+ FREE(&buf);
mutt_file_fclose(&fp);
return rc;
}
char sequences[_POSIX_PATH_MAX];
char *tmpfname = NULL;
- char *buff = NULL;
+ char *buf = NULL;
char *p = NULL;
size_t s;
int l = 0;
/* first, copy unknown sequences */
if ((ofp = fopen(sequences, "r")))
{
- while ((buff = mutt_file_read_line(buff, &s, ofp, &l, 0)))
+ while ((buf = mutt_file_read_line(buf, &s, ofp, &l, 0)))
{
- if (mutt_str_strncmp(buff, seq_unseen, mutt_str_strlen(seq_unseen)) == 0)
+ if (mutt_str_strncmp(buf, seq_unseen, mutt_str_strlen(seq_unseen)) == 0)
continue;
- if (mutt_str_strncmp(buff, seq_flagged, mutt_str_strlen(seq_flagged)) == 0)
+ if (mutt_str_strncmp(buf, seq_flagged, mutt_str_strlen(seq_flagged)) == 0)
continue;
- if (mutt_str_strncmp(buff, seq_replied, mutt_str_strlen(seq_replied)) == 0)
+ if (mutt_str_strncmp(buf, seq_replied, mutt_str_strlen(seq_replied)) == 0)
continue;
- fprintf(nfp, "%s\n", buff);
+ fprintf(nfp, "%s\n", buf);
}
}
mutt_file_fclose(&ofp);
char seq_replied[STRING];
char seq_flagged[STRING];
- char *buff = NULL;
+ char *buf = NULL;
int line = 0;
size_t sz;
snprintf(sequences, sizeof(sequences), "%s/.mh_sequences", ctx->path);
if ((ofp = fopen(sequences, "r")))
{
- while ((buff = mutt_file_read_line(buff, &sz, ofp, &line, 0)))
+ while ((buf = mutt_file_read_line(buf, &sz, ofp, &line, 0)))
{
- if (unseen && (strncmp(buff, seq_unseen, mutt_str_strlen(seq_unseen)) == 0))
+ if (unseen && (strncmp(buf, seq_unseen, mutt_str_strlen(seq_unseen)) == 0))
{
- fprintf(nfp, "%s %d\n", buff, n);
+ fprintf(nfp, "%s %d\n", buf, n);
unseen_done = 1;
}
- else if (flagged && (strncmp(buff, seq_flagged, mutt_str_strlen(seq_flagged)) == 0))
+ else if (flagged && (strncmp(buf, seq_flagged, mutt_str_strlen(seq_flagged)) == 0))
{
- fprintf(nfp, "%s %d\n", buff, n);
+ fprintf(nfp, "%s %d\n", buf, n);
flagged_done = 1;
}
- else if (replied && (strncmp(buff, seq_replied, mutt_str_strlen(seq_replied)) == 0))
+ else if (replied && (strncmp(buf, seq_replied, mutt_str_strlen(seq_replied)) == 0))
{
- fprintf(nfp, "%s %d\n", buff, n);
+ fprintf(nfp, "%s %d\n", buf, n);
replied_done = 1;
}
else
- fprintf(nfp, "%s\n", buff);
+ fprintf(nfp, "%s\n", buf);
}
}
mutt_file_fclose(&ofp);
- FREE(&buff);
+ FREE(&buf);
if (!unseen_done && unseen)
fprintf(nfp, "%s: %d\n", NONULL(MhSeqUnseen), n);
static int mbox_to_udomain(const char *mbx, char **user, char **domain)
{
- static char *buff = NULL;
+ static char *buf = NULL;
char *p = NULL;
- mutt_str_replace(&buff, mbx);
- if (!buff)
+ mutt_str_replace(&buf, mbx);
+ if (!buf)
return -1;
- p = strchr(buff, '@');
+ p = strchr(buf, '@');
if (!p || !p[1])
return -1;
*p = '\0';
- *user = buff;
+ *user = buf;
*domain = p + 1;
return 0;
}
const char *mutt_addr_for_display(struct Address *a)
{
char *user = NULL, *domain = NULL;
- static char *buff = NULL;
+ static char *buf = NULL;
char *local_mailbox = NULL;
- FREE(&buff);
+ FREE(&buf);
if (!a->mailbox || addr_is_local(a))
return a->mailbox;
if (!local_mailbox)
return a->mailbox;
- mutt_str_replace(&buff, local_mailbox);
+ mutt_str_replace(&buf, local_mailbox);
FREE(&local_mailbox);
- return buff;
+ return buf;
}
/**
*/
static char *crypt_key_abilities(int flags)
{
- static char buff[3];
+ static char buf[3];
if (!(flags & KEYFLAG_CANENCRYPT))
- buff[0] = '-';
+ buf[0] = '-';
else if (flags & KEYFLAG_PREFER_SIGNING)
- buff[0] = '.';
+ buf[0] = '.';
else
- buff[0] = 'e';
+ buf[0] = 'e';
if (!(flags & KEYFLAG_CANSIGN))
- buff[1] = '-';
+ buf[1] = '-';
else if (flags & KEYFLAG_PREFER_ENCRYPTION)
- buff[1] = '.';
+ buf[1] = '.';
else
- buff[1] = 's';
+ buf[1] = 's';
- buff[2] = '\0';
+ buf[2] = '\0';
- return buff;
+ return buf;
}
/**
!crypt_id_is_strong(key_table[menu->current])))
{
const char *warn_s = NULL;
- char buff[LONG_STRING];
+ char buf2[LONG_STRING];
if (key_table[menu->current]->flags & KEYFLAG_CANTUSE)
warn_s = N_("ID is expired/disabled/revoked.");
}
}
- snprintf(buff, sizeof(buff),
+ snprintf(buf2, sizeof(buf2),
_("%s Do you really want to use the key?"), _(warn_s));
- if (mutt_yesorno(buff, 0) != MUTT_YES)
+ if (mutt_yesorno(buf2, 0) != MUTT_YES)
{
mutt_clear_error();
break;
gpgme_data_t keydata = NULL;
gpgme_error_t err;
struct Body *att = NULL;
- char buff[LONG_STRING];
+ char buf[LONG_STRING];
struct stat sb;
unset_option(OPT_PGP_CHECK_TRUST);
MIME description for exported (attached) keys.
You can translate this entry to a non-ASCII string (it will be encoded),
but it may be safer to keep it untranslated. */
- snprintf(buff, sizeof(buff), _("PGP Key 0x%s."), crypt_keyid(key));
- att->description = mutt_str_strdup(buff);
+ snprintf(buf, sizeof(buf), _("PGP Key 0x%s."), crypt_keyid(key));
+ att->description = mutt_str_strdup(buf);
mutt_update_encoding(att);
stat(tempf, &sb);
bool empty = false;
bool err;
- char buff[STRING];
+ char buf[STRING];
pid_t thepid;
err = false;
- while (fgets(buff, sizeof(buff), pgperr))
+ while (fgets(buf, sizeof(buf), pgperr))
{
err = true;
- fputs(buff, stdout);
+ fputs(buf, stdout);
}
mutt_file_fclose(&pgperr);
void pgp_invoke_getkeys(struct Address *addr)
{
- char buff[LONG_STRING];
+ char buf[LONG_STRING];
char tmp[LONG_STRING];
char cmd[HUGE_STRING];
int devnull;
*tmp = '\0';
mutt_addrlist_to_local(addr);
rfc822_write_address_single(tmp, sizeof(tmp), addr, 0);
- mutt_file_quote_filename(buff, sizeof(buff), tmp);
+ mutt_file_quote_filename(buf, sizeof(buf), tmp);
addr->personal = personal;
- cctx.ids = buff;
+ cctx.ids = buf;
mutt_pgp_command(cmd, sizeof(cmd), &cctx, PgpGetkeysCommand);
static char *pgp_key_abilities(int flags)
{
- static char buff[3];
+ static char buf[3];
if (!(flags & KEYFLAG_CANENCRYPT))
- buff[0] = '-';
+ buf[0] = '-';
else if (flags & KEYFLAG_PREFER_SIGNING)
- buff[0] = '.';
+ buf[0] = '.';
else
- buff[0] = 'e';
+ buf[0] = 'e';
if (!(flags & KEYFLAG_CANSIGN))
- buff[1] = '-';
+ buf[1] = '-';
else if (flags & KEYFLAG_PREFER_ENCRYPTION)
- buff[1] = '.';
+ buf[1] = '.';
else
- buff[1] = 's';
+ buf[1] = 's';
- buff[2] = '\0';
+ buf[2] = '\0';
- return buff;
+ return buf;
}
static char pgp_flags(int flags)
!pgp_id_is_strong(KeyTable[menu->current])))
{
char *str = "";
- char buff[LONG_STRING];
+ char buf2[LONG_STRING];
if (KeyTable[menu->current]->flags & KEYFLAG_CANTUSE)
str = N_("ID is expired/disabled/revoked.");
break;
}
- snprintf(buff, sizeof(buff),
+ snprintf(buf2, sizeof(buf2),
_("%s Do you really want to use the key?"), _(str));
- if (mutt_yesorno(buff, MUTT_NO) != MUTT_YES)
+ if (mutt_yesorno(buf2, MUTT_NO) != MUTT_YES)
{
mutt_clear_error();
break;
struct Body *pgp_make_key_attachment(char *tempf)
{
struct Body *att = NULL;
- char buff[LONG_STRING];
+ char buf[LONG_STRING];
char tempfb[_POSIX_PATH_MAX], tmp[STRING];
FILE *tempfp = NULL;
FILE *devnull = NULL;
att->use_disp = false;
att->type = TYPEAPPLICATION;
att->subtype = mutt_str_strdup("pgp-keys");
- snprintf(buff, sizeof(buff), _("PGP Key %s."), tmp);
- att->description = mutt_str_strdup(buff);
+ snprintf(buf, sizeof(buf), _("PGP Key %s."), tmp);
+ att->description = mutt_str_strdup(buf);
mutt_update_encoding(att);
stat(tempf, &sb);
static char *smime_key_flags(int flags)
{
- static char buff[3];
+ static char buf[3];
if (!(flags & KEYFLAG_CANENCRYPT))
- buff[0] = '-';
+ buf[0] = '-';
else
- buff[0] = 'e';
+ buf[0] = 'e';
if (!(flags & KEYFLAG_CANSIGN))
- buff[1] = '-';
+ buf[1] = '-';
else
- buff[1] = 's';
+ buf[1] = 's';
- buff[2] = '\0';
+ buf[2] = '\0';
- return buff;
+ return buf;
}
static void smime_entry(char *s, size_t l, struct Menu *menu, int num)
/**
* pgp_make_pgp2_fingerprint - The actual key ring parser
*/
-static void pgp_make_pgp2_fingerprint(unsigned char *buff, unsigned char *digest)
+static void pgp_make_pgp2_fingerprint(unsigned char *buf, unsigned char *digest)
{
struct Md5Ctx ctx;
unsigned int size = 0;
mutt_md5_init_ctx(&ctx);
- size = (buff[0] << 8) + buff[1];
+ size = (buf[0] << 8) + buf[1];
size = ((size + 7) / 8);
- buff = &buff[2];
+ buf = &buf[2];
- mutt_md5_process_bytes(buff, size, &ctx);
+ mutt_md5_process_bytes(buf, size, &ctx);
- buff = &buff[size];
+ buf = &buf[size];
- size = (buff[0] << 8) + buff[1];
+ size = (buf[0] << 8) + buf[1];
size = ((size + 7) / 8);
- buff = &buff[2];
+ buf = &buf[2];
- mutt_md5_process_bytes(buff, size, &ctx);
+ mutt_md5_process_bytes(buf, size, &ctx);
mutt_md5_finish_ctx(&ctx, digest);
}
-static char *binary_fingerprint_to_string(unsigned char *buff, size_t length)
+static char *binary_fingerprint_to_string(unsigned char *buf, size_t length)
{
char *fingerprint = NULL, *pf = NULL;
for (int i = 0; i < length; i++)
{
- sprintf(pf, "%02X", buff[i]);
+ sprintf(pf, "%02X", buf[i]);
pf += 2;
}
*pf = 0;
return fingerprint;
}
-static struct PgpKeyInfo *pgp_parse_pgp2_key(unsigned char *buff, size_t l)
+static struct PgpKeyInfo *pgp_parse_pgp2_key(unsigned char *buf, size_t l)
{
struct PgpKeyInfo *p = NULL;
unsigned char alg;
p = pgp_new_keyinfo();
for (i = 0, j = 2; i < 4; i++)
- gen_time = (gen_time << 8) + buff[j++];
+ gen_time = (gen_time << 8) + buf[j++];
p->gen_time = gen_time;
for (i = 0; i < 2; i++)
- exp_days = (exp_days << 8) + buff[j++];
+ exp_days = (exp_days << 8) + buf[j++];
if (exp_days && time(NULL) > gen_time + exp_days * 24 * 3600)
p->flags |= KEYFLAG_EXPIRED;
- alg = buff[j++];
+ alg = buf[j++];
p->numalg = alg;
p->algorithm = pgp_pkalgbytype(alg);
if (dump_fingerprints)
{
/* j now points to the key material, which we need for the fingerprint */
- pgp_make_pgp2_fingerprint(&buff[j], digest);
+ pgp_make_pgp2_fingerprint(&buf[j], digest);
p->fingerprint = binary_fingerprint_to_string(digest, MD5_DIGEST_LENGTH);
}
expl = 0;
for (i = 0; i < 2; i++)
- expl = (expl << 8) + buff[j++];
+ expl = (expl << 8) + buf[j++];
p->keylen = expl;
for (int k = 0; k < 2; k++)
{
for (id = 0, i = 0; i < 4; i++)
- id = (id << 8) + buff[j++];
+ id = (id << 8) + buf[j++];
snprintf((char *) scratch + k * 8, sizeof(scratch) - k * 8, "%08lX", id);
}
return NULL;
}
-static void pgp_make_pgp3_fingerprint(unsigned char *buff, size_t l, unsigned char *digest)
+static void pgp_make_pgp3_fingerprint(unsigned char *buf, size_t l, unsigned char *digest)
{
unsigned char dummy;
struct Sha1Ctx context;
mutt_sha1_init(&context);
- dummy = buff[0] & 0x3f;
+ dummy = buf[0] & 0x3f;
if (dummy == PT_SUBSECKEY || dummy == PT_SUBKEY || dummy == PT_SECKEY)
dummy = PT_PUBKEY;
mutt_sha1_update(&context, &dummy, 1);
dummy = (l - 1) & 0xff;
mutt_sha1_update(&context, &dummy, 1);
- mutt_sha1_update(&context, buff + 1, l - 1);
+ mutt_sha1_update(&context, buf + 1, l - 1);
mutt_sha1_final(digest, &context);
}
-static void skip_bignum(unsigned char *buff, size_t l, size_t j, size_t *toff, size_t n)
+static void skip_bignum(unsigned char *buf, size_t l, size_t j, size_t *toff, size_t n)
{
size_t len;
do
{
- len = (buff[j] << 8) + buff[j + 1];
+ len = (buf[j] << 8) + buf[j + 1];
j += (len + 7) / 8 + 2;
} while (j <= l && --n > 0);
*toff = j;
}
-static struct PgpKeyInfo *pgp_parse_pgp3_key(unsigned char *buff, size_t l)
+static struct PgpKeyInfo *pgp_parse_pgp3_key(unsigned char *buf, size_t l)
{
struct PgpKeyInfo *p = NULL;
unsigned char alg;
j = 2;
for (i = 0; i < 4; i++)
- gen_time = (gen_time << 8) + buff[j++];
+ gen_time = (gen_time << 8) + buf[j++];
p->gen_time = gen_time;
- alg = buff[j++];
+ alg = buf[j++];
p->numalg = alg;
p->algorithm = pgp_pkalgbytype(alg);
p->flags |= pgp_get_abilities(alg);
- len = (buff[j] << 8) + buff[j + 1];
+ len = (buf[j] << 8) + buf[j + 1];
p->keylen = len;
if (alg >= 1 && alg <= 3)
- skip_bignum(buff, l, j, &j, 2);
+ skip_bignum(buf, l, j, &j, 2);
else if (alg == 16 || alg == 20)
- skip_bignum(buff, l, j, &j, 3);
+ skip_bignum(buf, l, j, &j, 3);
else if (alg == 17)
- skip_bignum(buff, l, j, &j, 4);
+ skip_bignum(buf, l, j, &j, 4);
- pgp_make_pgp3_fingerprint(buff, j, digest);
+ pgp_make_pgp3_fingerprint(buf, j, digest);
if (dump_fingerprints)
{
p->fingerprint = binary_fingerprint_to_string(digest, SHA_DIGEST_LENGTH);
return p;
}
-static struct PgpKeyInfo *pgp_parse_keyinfo(unsigned char *buff, size_t l)
+static struct PgpKeyInfo *pgp_parse_keyinfo(unsigned char *buf, size_t l)
{
- if (!buff || l < 2)
+ if (!buf || l < 2)
return NULL;
- switch (buff[1])
+ switch (buf[1])
{
case 2:
case 3:
- return pgp_parse_pgp2_key(buff, l);
+ return pgp_parse_pgp2_key(buf, l);
case 4:
- return pgp_parse_pgp3_key(buff, l);
+ return pgp_parse_pgp3_key(buf, l);
default:
return NULL;
}
}
-static int pgp_parse_pgp2_sig(unsigned char *buff, size_t l,
+static int pgp_parse_pgp2_sig(unsigned char *buf, size_t l,
struct PgpKeyInfo *p, struct PgpSignature *s)
{
unsigned char sigtype;
return -1;
j = 3;
- sigtype = buff[j++];
+ sigtype = buf[j++];
sig_gen_time = 0;
for (int i = 0; i < 4; i++)
- sig_gen_time = (sig_gen_time << 8) + buff[j++];
+ sig_gen_time = (sig_gen_time << 8) + buf[j++];
signerid1 = signerid2 = 0;
for (int i = 0; i < 4; i++)
- signerid1 = (signerid1 << 8) + buff[j++];
+ signerid1 = (signerid1 << 8) + buf[j++];
for (int i = 0; i < 4; i++)
- signerid2 = (signerid2 << 8) + buff[j++];
+ signerid2 = (signerid2 << 8) + buf[j++];
if (sigtype == 0x20 || sigtype == 0x28)
p->flags |= KEYFLAG_REVOKED;
return 0;
}
-static int pgp_parse_pgp3_sig(unsigned char *buff, size_t l,
+static int pgp_parse_pgp3_sig(unsigned char *buf, size_t l,
struct PgpKeyInfo *p, struct PgpSignature *s)
{
unsigned char sigtype;
j = 2;
- sigtype = buff[j++];
+ sigtype = buf[j++];
j += 2; /* pkalg, hashalg */
for (short ii = 0; ii < 2; ii++)
size_t skl;
size_t nextone;
- ml = (buff[j] << 8) + buff[j + 1];
+ ml = (buf[j] << 8) + buf[j + 1];
j += 2;
if (j + ml > l)
while (ml)
{
j = nextone;
- skl = buff[j++];
+ skl = buf[j++];
if (!--ml)
break;
if (skl >= 192)
{
- skl = (skl - 192) * 256 + buff[j++] + 192;
+ skl = (skl - 192) * 256 + buf[j++] + 192;
if (!--ml)
break;
}
ml -= skl;
nextone = j + skl;
- skt = buff[j++];
+ skt = buf[j++];
switch (skt & 0x7f)
{
break;
sig_gen_time = 0;
for (int i = 0; i < 4; i++)
- sig_gen_time = (sig_gen_time << 8) + buff[j++];
+ sig_gen_time = (sig_gen_time << 8) + buf[j++];
break;
}
break;
validity = 0;
for (int i = 0; i < 4; i++)
- validity = (validity << 8) + buff[j++];
+ validity = (validity << 8) + buf[j++];
break;
}
case 9: /* key expiration time */
break;
key_validity = 0;
for (int i = 0; i < 4; i++)
- key_validity = (key_validity << 8) + buff[j++];
+ key_validity = (key_validity << 8) + buf[j++];
break;
}
case 16: /* issuer key ID */
break;
signerid2 = signerid1 = 0;
for (int i = 0; i < 4; i++)
- signerid1 = (signerid1 << 8) + buff[j++];
+ signerid1 = (signerid1 << 8) + buf[j++];
for (int i = 0; i < 4; i++)
- signerid2 = (signerid2 << 8) + buff[j++];
+ signerid2 = (signerid2 << 8) + buf[j++];
break;
}
return 0;
}
-static int pgp_parse_sig(unsigned char *buff, size_t l, struct PgpKeyInfo *p,
+static int pgp_parse_sig(unsigned char *buf, size_t l, struct PgpKeyInfo *p,
struct PgpSignature *sig)
{
- if (!buff || l < 2 || !p)
+ if (!buf || l < 2 || !p)
return -1;
- switch (buff[1])
+ switch (buf[1])
{
case 2:
case 3:
- return pgp_parse_pgp2_sig(buff, l, p, sig);
+ return pgp_parse_pgp2_sig(buf, l, p, sig);
case 4:
- return pgp_parse_pgp3_sig(buff, l, p, sig);
+ return pgp_parse_pgp3_sig(buf, l, p, sig);
default:
return -1;
}
static struct PgpKeyInfo *pgp_parse_keyblock(FILE *fp)
{
- unsigned char *buff = NULL;
+ unsigned char *buf = NULL;
unsigned char pt = 0;
unsigned char last_pt;
size_t l = 0;
fgetpos(fp, &pos);
- while (!err && (buff = pgp_read_packet(fp, &l)) != NULL)
+ while (!err && (buf = pgp_read_packet(fp, &l)) != NULL)
{
last_pt = pt;
- pt = buff[0] & 0x3f;
+ pt = buf[0] & 0x3f;
/* check if we have read the complete key block. */
case PT_SUBKEY:
case PT_SUBSECKEY:
{
- *last = p = pgp_parse_keyinfo(buff, l);
+ *last = p = pgp_parse_keyinfo(buf, l);
if (!*last)
{
err = 1;
*lsig = signature;
lsig = &signature->next;
- pgp_parse_sig(buff, l, p, signature);
+ pgp_parse_sig(buf, l, p, signature);
}
break;
}
if (p && (last_pt == PT_SECKEY || last_pt == PT_PUBKEY ||
last_pt == PT_SUBKEY || last_pt == PT_SUBSECKEY))
{
- if (buff[1] & 0x20)
+ if (buf[1] & 0x20)
{
p->flags |= KEYFLAG_DISABLED;
}
}
else if (last_pt == PT_NAME && uid)
{
- uid->trust = buff[1];
+ uid->trust = buf[1];
}
break;
}
chr = mutt_mem_malloc(l);
if (l > 0)
{
- memcpy(chr, buff + 1, l - 1);
+ memcpy(chr, buf + 1, l - 1);
chr[l - 1] = '\0';
}
FILE *rfp = NULL;
fpos_t pos, keypos;
- unsigned char *buff = NULL;
+ unsigned char *buf = NULL;
unsigned char pt = 0;
size_t l = 0;
fgetpos(rfp, &pos);
fgetpos(rfp, &keypos);
- while (!err && (buff = pgp_read_packet(rfp, &l)) != NULL)
+ while (!err && (buf = pgp_read_packet(rfp, &l)) != NULL)
{
- pt = buff[0] & 0x3f;
+ pt = buf[0] & 0x3f;
if (l < 1)
continue;
{
char *tmp = mutt_mem_malloc(l);
- memcpy(tmp, buff + 1, l - 1);
+ memcpy(tmp, buf + 1, l - 1);
tmp[l - 1] = '\0';
if (pgpring_string_matches_hint(tmp, hints, nhints))
int mutt_num_postponed(int force);
int mutt_parse_bind(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
int mutt_parse_exec(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
-int mutt_parse_color(struct Buffer *buff, struct Buffer *s, unsigned long data, struct Buffer *err);
+int mutt_parse_color(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
int mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
int mutt_parse_macro(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
int mutt_parse_mailboxes(struct Buffer *path, struct Buffer *s, unsigned long data, struct Buffer *err);
int mutt_parse_unmailboxes(struct Buffer *path, struct Buffer *s, unsigned long data, struct Buffer *err);
-int mutt_parse_mono(struct Buffer *buff, struct Buffer *s, unsigned long data, struct Buffer *err);
+int mutt_parse_mono(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
int mutt_parse_unmono(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
int mutt_parse_push(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
int mutt_parse_rc_line(/* const */ char *line, struct Buffer *token, struct Buffer *err);
static const char *mix_format_caps(struct Remailer *r)
{
- static char capbuff[10];
- char *t = capbuff;
+ static char capbuf[10];
+ char *t = capbuf;
if (r->caps & MIX_CAP_COMPRESS)
*t++ = 'C';
*t = '\0';
- return capbuff;
+ return capbuf;
}
/**
char *mutt_choose_charset(const char *fromcode, const char *charsets, char *u,
size_t ulen, char **d, size_t *dlen)
{
- char canonical_buff[LONG_STRING];
+ char canonical_buf[LONG_STRING];
char *e = NULL, *tocode = NULL;
size_t elen = 0, bestn = 0;
const char *q = NULL;
if (dlen)
*dlen = elen;
- mutt_canonical_charset(canonical_buff, sizeof(canonical_buff), tocode);
- mutt_str_replace(&tocode, canonical_buff);
+ mutt_canonical_charset(canonical_buf, sizeof(canonical_buf), tocode);
+ mutt_str_replace(&tocode, canonical_buf);
}
return tocode;
}
static void transform_to_7bit(struct Body *a, FILE *fpin)
{
- char buff[_POSIX_PATH_MAX];
+ char buf[_POSIX_PATH_MAX];
struct State s;
struct stat sb;
a->noconv = true;
a->force_charset = true;
- mutt_mktemp(buff, sizeof(buff));
- s.fpout = mutt_file_fopen(buff, "w");
+ mutt_mktemp(buf, sizeof(buf));
+ s.fpout = mutt_file_fopen(buf, "w");
if (!s.fpout)
{
mutt_perror("fopen");
mutt_file_fclose(&s.fpout);
FREE(&a->d_filename);
a->d_filename = a->filename;
- a->filename = mutt_str_strdup(buff);
+ a->filename = mutt_str_strdup(buf);
a->unlink = true;
if (stat(a->filename, &sb) == -1)
{
void mutt_update_encoding(struct Body *a)
{
struct Content *info = NULL;
- char chsbuff[STRING];
+ char chsbuf[STRING];
/* override noconv when it's us-ascii */
- if (mutt_is_us_ascii(mutt_get_body_charset(chsbuff, sizeof(chsbuff), a)))
+ if (mutt_is_us_ascii(mutt_get_body_charset(chsbuf, sizeof(chsbuf), a)))
a->noconv = false;
if (!a->force_charset && !a->noconv)