summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
69819af)
Knowing the domain of the variable is Boolean aids comprehension of the
variable's name and purpose.
32 files changed:
AddFolder(char *name, int force)
{
unsigned int i;
AddFolder(char *name, int force)
{
unsigned int i;
+ int msgnum;
+ bool nonzero;
ivector_t seqnum = ivector_create (0), nSeq = ivector_create (0);
struct Folder *f;
struct msgs *mp;
ivector_t seqnum = ivector_create (0), nSeq = ivector_create (0);
struct Folder *f;
struct msgs *mp;
}
/* Check if any of the sequence checks were nonzero */
}
/* Check if any of the sequence checks were nonzero */
for (i = 0; i < svector_size (sequencesToDo); i++) {
if (ivector_at (nSeq, i) > 0) {
for (i = 0; i < svector_size (sequencesToDo); i++) {
if (ivector_at (nSeq, i) > 0) {
PrintFolders(void)
{
char tmpname[BUFSIZ];
PrintFolders(void)
{
char tmpname[BUFSIZ];
- unsigned int i, j, len, has_private = 0;
+ unsigned int i, j, len;
+ bool has_private = false;
unsigned int maxfolderlen = 0, maxseqlen = 0;
int maxnum = 0, maxseq = 0;
unsigned int maxfolderlen = 0, maxseqlen = 0;
int maxnum = 0, maxseq = 0;
/* check if this sequence is private in any of the folders */
if (ivector_at (folders[i].private, j))
/* check if this sequence is private in any of the folders */
if (ivector_at (folders[i].private, j))
static int insert(struct mailname *);
static void mlistfree(void);
static int insert(struct mailname *);
static void mlistfree(void);
-static int nodupcheck = 0; /* If set, no check for duplicates */
+static bool nodupcheck; /* If set, no check for duplicates */
static int ccme = 0; /* Should I cc myself? */
static struct mailname mq; /* Mail addresses to check for duplicates */
static char *dummy = "dummy";
static int ccme = 0; /* Should I cc myself? */
static struct mailname mq; /* Mail addresses to check for duplicates */
static char *dummy = "dummy";
cp = test_formataddr(orig, str);
cp = test_formataddr(orig, str);
static int fheader = 0; /* should we output a header? */
static int frecurse = 0; /* recurse through subfolders */
static int ftotal = 0; /* should we output the totals? */
static int fheader = 0; /* should we output a header? */
static int frecurse = 0; /* recurse through subfolders */
static int ftotal = 0; /* should we output the totals? */
-static int all = 0; /* should we output all folders */
+static bool all; /* should we output all folders */
static int total_folders = 0; /* total number of folders */
static int total_folders = 0; /* total number of folders */
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
- int printsw = 0, listsw = 0;
- int pushsw = 0, popsw = 0;
+ bool printsw = false;
+ bool listsw = false;
+ bool pushsw = false;
+ bool popsw = false;
char *cp, *dp, *msg = NULL, *argfolder = NULL;
char **ap, **argp, buf[BUFSIZ], **arguments;
char *cp, *dp, *msg = NULL, *argfolder = NULL;
char **ap, **argp, buf[BUFSIZ], **arguments;
- pushsw = 1;
- listsw = 1;
- popsw = 0;
+ pushsw = true;
+ listsw = true;
+ popsw = false;
- popsw = 1;
- listsw = 1;
- pushsw = 0;
+ popsw = true;
+ listsw = true;
+ pushsw = false;
* If we aren't working with the folder stack
* (-push, -pop, -list) then the default is to print.
*/
* If we aren't working with the folder stack
* (-push, -pop, -list) then the default is to print.
*/
- if (pushsw == 0 && popsw == 0 && listsw == 0)
- printsw++;
+ if (!pushsw && !popsw && !listsw)
+ printsw = true;
/* Pushing a folder onto the folder stack */
if (pushsw) {
/* Pushing a folder onto the folder stack */
if (pushsw) {
static void
print_folders (void)
{
static void
print_folders (void)
{
- int i, len, hasempty = 0, curprinted;
+ int i, len;
+ bool hasempty = false;
+ bool curprinted;
int maxlen = 0, maxnummsg = 0, maxlowmsg = 0;
int maxhghmsg = 0, maxcurmsg = 0, total_msgs = 0;
int nummsgdigits, lowmsgdigits;
int maxlen = 0, maxnummsg = 0, maxlowmsg = 0;
int maxhghmsg = 0, maxcurmsg = 0, total_msgs = 0;
int nummsgdigits, lowmsgdigits;
/* check for empty folders */
if (fi[i].nummsg == 0)
/* check for empty folders */
if (fi[i].nummsg == 0)
}
nummsgdigits = num_digits (maxnummsg);
lowmsgdigits = num_digits (maxlowmsg);
}
nummsgdigits = num_digits (maxnummsg);
lowmsgdigits = num_digits (maxlowmsg);
printf ("%-*s ", maxlen+1, tmpname);
printf ("%-*s ", maxlen+1, tmpname);
- curprinted = 0; /* remember if we print cur */
+ curprinted = false; /* remember if we print cur */
if (fi[i].nummsg == 0) {
printf ("has %*s messages%*s",
nummsgdigits, "no",
if (fi[i].nummsg == 0) {
printf ("has %*s messages%*s",
nummsgdigits, "no",
lowmsgdigits, fi[i].lowmsg,
hghmsgdigits, fi[i].hghmsg);
if (fi[i].curmsg >= fi[i].lowmsg && fi[i].curmsg <= fi[i].hghmsg) {
lowmsgdigits, fi[i].lowmsg,
hghmsgdigits, fi[i].hghmsg);
if (fi[i].curmsg >= fi[i].lowmsg && fi[i].curmsg <= fi[i].hghmsg) {
printf ("; cur=%*d", curmsgdigits, fi[i].curmsg);
}
}
printf ("; cur=%*d", curmsgdigits, fi[i].curmsg);
}
}
struct passwd *pw;
struct stat st;
FILE *in, *out;
struct passwd *pw;
struct stat st;
FILE *in, *out;
if (nmh_init(argv[0], false, false)) { return 1; }
arguments = getarguments (invo_name, argc, argv, 0);
argp = arguments;
if (nmh_init(argv[0], false, false)) { return 1; }
arguments = getarguments (invo_name, argc, argv, 0);
argp = arguments;
while ((dp = *argp++)) {
if (*dp == '-') {
while ((dp = *argp++)) {
if (*dp == '-') {
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
- int sizesw = 1, headsw = 1, directives = 1, autobuild = 0, dist = 0;
- int verbosw = 0, dispo = 0;
+ int sizesw = 1, headsw = 1;
+ bool directives = true;
+ bool autobuild = false;
+ bool dist = false;
+ int verbosw = 0;
+ bool dispo = false;
size_t maxunencoded = MAXTEXTPERLN;
int *icachesw;
char *cp, buf[BUFSIZ];
size_t maxunencoded = MAXTEXTPERLN;
int *icachesw;
char *cp, buf[BUFSIZ];
case AUTOSW:
/* -auto implies -nodirectives */
case AUTOSW:
/* -auto implies -nodirectives */
- autobuild = 1;
- directives = 0;
+ autobuild = true;
+ directives = false;
continue;
case NAUTOSW:
/*
* We're turning directives back on since this is likely here
* to override a profile entry
*/
continue;
case NAUTOSW:
/*
* We're turning directives back on since this is likely here
* to override a profile entry
*/
- autobuild = 0;
- directives = 1;
+ autobuild = false;
+ directives = true;
continue;
case DIRECTIVES:
continue;
case DIRECTIVES:
continue;
case NDIRECTIVES:
continue;
case NDIRECTIVES:
verbosw = 0;
continue;
case DISPOSW:
verbosw = 0;
continue;
case DISPOSW:
continue;
case DEBUGSW:
debugsw = 1;
continue;
case DISTSW:
continue;
case DEBUGSW:
debugsw = 1;
continue;
case DISTSW:
*/
if (!do_direct() || buf[0] != '#' || buf[1] == '#' || buf[1] == '<') {
int headers;
*/
if (!do_direct() || buf[0] != '#' || buf[1] == '#' || buf[1] == '<') {
int headers;
long pos;
char content[BUFSIZ];
FILE *out;
long pos;
char content[BUFSIZ];
FILE *out;
if (do_direct() && (buf[0] == '#' && buf[1] == '<')) {
strncpy (content, buf + 2, sizeof(content));
if (do_direct() && (buf[0] == '#' && buf[1] == '<')) {
strncpy (content, buf + 2, sizeof(content));
/* the directive is implicit */
strncpy (content, "text/plain", sizeof(content));
/* the directive is implicit */
strncpy (content, "text/plain", sizeof(content));
* subparts with the rfc934 compatibility mode flag.
*/
if (rfc934sw && ct->c_subtype == MULTI_DIGEST) {
* subparts with the rfc934 compatibility mode flag.
*/
if (rfc934sw && ct->c_subtype == MULTI_DIGEST) {
for (part = m->mp_parts; part; part = part->mp_next) {
CT p = part->mp_part;
if (p->c_subtype != MESSAGE_RFC822) {
for (part = m->mp_parts; part; part = part->mp_next) {
CT p = part->mp_part;
if (p->c_subtype != MESSAGE_RFC822) {
default:
if (!ce->ce_file) {
pid_t child_id;
default:
if (!ce->ce_file) {
pid_t child_id;
- int xstdout, len, buflen;
+ bool xstdout;
+ int len, buflen;
char *bp, *cp;
char *vec[4], buffer[BUFSIZ];
FILE *out;
char *bp, *cp;
char *vec[4], buffer[BUFSIZ];
FILE *out;
ce->ce_file = mh_xstrdup(tfile);
ce->ce_unlink = 1;
ce->ce_file = mh_xstrdup(tfile);
ce->ce_unlink = 1;
/* Get buffer ready to go */
bp = buffer;
/* Get buffer ready to go */
bp = buffer;
case 'F':
/* %f, and stdout is not-redirected */
case 'F':
/* %f, and stdout is not-redirected */
scan_content (CT ct, size_t maxunencoded)
{
int prefix_len;
scan_content (CT ct, size_t maxunencoded)
{
int prefix_len;
- int check8bit = 0, contains8bit = 0; /* check if contains 8bit data */
- int checknul = 0, containsnul = 0; /* check if contains NULs */
- int checklinelen = 0, linelen = 0; /* check for long lines */
- int checkllinelen = 0; /* check for extra-long lines */
- int checkboundary = 0, boundaryclash = 0; /* check if clashes with multipart boundary */
- int checklinespace = 0, linespace = 0; /* check if any line ends with space */
+ bool check8bit = false, contains8bit = false; /* check if contains 8bit data */
+ bool checknul = false, containsnul = false; /* check if contains NULs */
+ bool checklinelen = false, linelen = false; /* check for long lines */
+ bool checkllinelen = false; /* check for extra-long lines */
+ bool checkboundary = false, boundaryclash = false; /* check if clashes with multipart boundary */
+ bool checklinespace = false, linespace = false; /* check if any line ends with space */
char *cp = NULL;
char *bufp = NULL;
size_t buflen;
char *cp = NULL;
char *bufp = NULL;
size_t buflen;
if (ct->c_type == CT_TEXT) {
t = (struct text *) ct->c_ctparams;
if (t->tx_charset == CHARSET_UNSPECIFIED) {
if (ct->c_type == CT_TEXT) {
t = (struct text *) ct->c_ctparams;
if (t->tx_charset == CHARSET_UNSPECIFIED) {
}
switch (ct->c_reqencoding) {
case CE_8BIT:
}
switch (ct->c_reqencoding) {
case CE_8BIT:
- checkllinelen = 1;
- checkboundary = 1;
+ checkllinelen = true;
+ checkboundary = true;
break;
case CE_BASE64:
break;
break;
case CE_BASE64:
break;
/* Use the default rules based on content-type */
switch (ct->c_type) {
case CT_TEXT:
/* Use the default rules based on content-type */
switch (ct->c_type) {
case CT_TEXT:
- checkboundary = 1;
- checklinelen = 1;
+ checkboundary = true;
+ checklinelen = true;
if (ct->c_subtype == TEXT_PLAIN) {
if (ct->c_subtype == TEXT_PLAIN) {
+ checklinespace = false;
}
break;
case CT_APPLICATION:
}
break;
case CT_APPLICATION:
- check8bit = 1;
- checknul = 1;
- checklinelen = 1;
- checklinespace = 1;
- checkboundary = 1;
+ check8bit = true;
+ checknul = true;
+ checklinelen = true;
+ checklinespace = true;
+ checkboundary = true;
- checklinelen = 0;
- checklinespace = 0;
+ checklinelen = false;
+ checklinespace = false;
/* don't check anything for message/external */
if (ct->c_subtype == MESSAGE_EXTERNAL) {
/* don't check anything for message/external */
if (ct->c_subtype == MESSAGE_EXTERNAL) {
- checkboundary = 0;
- check8bit = 0;
+ checkboundary = false;
+ check8bit = false;
- checkboundary = 1;
- check8bit = 1;
+ checkboundary = true;
+ check8bit = true;
* since we are forcing use of base64, unless
* the content-type was specified by a mhbuild directive.
*/
* since we are forcing use of base64, unless
* the content-type was specified by a mhbuild directive.
*/
- check8bit = 0;
- checklinelen = 0;
- checklinespace = 0;
- checkboundary = 0;
+ check8bit = false;
+ checklinelen = false;
+ checklinespace = false;
+ checkboundary = false;
for (cp = bufp; (check8bit || checknul) &&
cp < bufp + gotlen; cp++) {
if (!isascii ((unsigned char) *cp)) {
for (cp = bufp; (check8bit || checknul) &&
cp < bufp + gotlen; cp++) {
if (!isascii ((unsigned char) *cp)) {
- contains8bit = 1;
- check8bit = 0; /* no need to keep checking */
+ contains8bit = true;
+ check8bit = false; /* no need to keep checking */
- containsnul = 1;
- checknul = 0; /* no need to keep checking */
+ containsnul = true;
+ checknul = false; /* no need to keep checking */
* Check line length.
*/
if (checklinelen && ((size_t)gotlen > maxunencoded + 1)) {
* Check line length.
*/
if (checklinelen && ((size_t)gotlen > maxunencoded + 1)) {
- linelen = 1;
- checklinelen = 0; /* no need to keep checking */
+ linelen = true;
+ checklinelen = false; /* no need to keep checking */
*/
if (checklinespace && (cp = bufp + gotlen - 2) > bufp &&
isspace ((unsigned char) *cp)) {
*/
if (checklinespace && (cp = bufp + gotlen - 2) > bufp &&
isspace ((unsigned char) *cp)) {
- linespace = 1;
- checklinespace = 0; /* no need to keep checking */
+ linespace = true;
+ checklinespace = false; /* no need to keep checking */
*++cp = '\0';
if (!strncmp(bufp + 2, prefix, prefix_len) &&
isdigit((unsigned char) bufp[2 + prefix_len])) {
*++cp = '\0';
if (!strncmp(bufp + 2, prefix, prefix_len) &&
isdigit((unsigned char) bufp[2 + prefix_len])) {
- boundaryclash = 1;
- checkboundary = 0; /* no need to keep checking */
+ boundaryclash = true;
+ checkboundary = false; /* no need to keep checking */
struct part *part;
if (ct->c_subtype == MULTI_ALTERNATE) {
struct part *part;
if (ct->c_subtype == MULTI_ALTERNATE) {
/* The parts are in descending priority order (defined by
RFC 2046 Sec. 5.1.4) because they were reversed by
/* The parts are in descending priority order (defined by
RFC 2046 Sec. 5.1.4) because they were reversed by
expand_pseudoheader (part->mp_part, &text_plain_ct,
m, infile,
c->type, c->argstring);
expand_pseudoheader (part->mp_part, &text_plain_ct,
m, infile,
c->type, c->argstring);
int
extract_headers (CT ct, char *reply_file, FILE **reply_fp) {
char *buffer = NULL, *cp, *end_of_header;
int
extract_headers (CT ct, char *reply_file, FILE **reply_fp) {
char *buffer = NULL, *cp, *end_of_header;
+ bool found_header = false;
struct stat statbuf;
/* Read the convert reply from the file to memory. */
struct stat statbuf;
/* Read the convert reply from the file to memory. */
buffer[LEN(TYPE_FIELD)] == ':') {
if ((end_of_header = strstr (buffer, "\r\n\r\n"))) {
end_of_header += 2;
buffer[LEN(TYPE_FIELD)] == ':') {
if ((end_of_header = strstr (buffer, "\r\n\r\n"))) {
end_of_header += 2;
} else if ((end_of_header = strstr (buffer, "\n\n"))) {
++end_of_header;
} else if ((end_of_header = strstr (buffer, "\n\n"))) {
++end_of_header;
find_cache_aux (int writing, char *directory, char *id,
char *buffer, int buflen)
{
find_cache_aux (int writing, char *directory, char *id,
char *buffer, int buflen)
{
+ int mask;
+ bool usemap;
char mapfile[BUFSIZ], mapname[BUFSIZ];
FILE *fp;
int failed_to_lock = 0;
static int partno, pid;
static time_t clock = 0;
char mapfile[BUFSIZ], mapname[BUFSIZ];
FILE *fp;
int failed_to_lock = 0;
static int partno, pid;
static time_t clock = 0;
if (debugsw)
fprintf (stderr, "find_cache_aux %s usemap=%d\n", directory, usemap);
if (debugsw)
fprintf (stderr, "find_cache_aux %s usemap=%d\n", directory, usemap);
struct msgs *mp = NULL;
CT *ctp;
FILE *fp, *infp = NULL, *outfp = NULL;
struct msgs *mp = NULL;
CT *ctp;
FILE *fp, *infp = NULL, *outfp = NULL;
- int using_stdin = 0;
- int chgflag = 1;
+ bool using_stdin = false;
+ bool chgflag = true;
int status = OK;
fix_transformations fx;
fx.reformat = fx.fixcompositecte = fx.fixboundary = 1;
int status = OK;
fix_transformations fx;
fx.reformat = fx.fixcompositecte = fx.fixboundary = 1;
rmmproc = NULL;
continue;
case CHGSW:
rmmproc = NULL;
continue;
case CHGSW:
continue;
case VERBSW:
verbosw = 1;
continue;
case VERBSW:
verbosw = 1;
if ((cp = m_mktemp2 (NULL, invo_name, &fd, NULL)) == NULL) {
die("unable to create temporary file in %s",
if ((cp = m_mktemp2 (NULL, invo_name, &fd, NULL)) == NULL) {
die("unable to create temporary file in %s",
char *input_filename = maildir
? concat (maildir, "/", (*ctp)->c_file, NULL)
: mh_xstrdup ((*ctp)->c_file);
char *input_filename = maildir
? concat (maildir, "/", (*ctp)->c_file, NULL)
: mh_xstrdup ((*ctp)->c_file);
- int modify_inplace = 0;
+ bool modify_inplace = false;
int message_mods = 0;
int status = OK;
int message_mods = 0;
int status = OK;
if ((*ctp)->c_file) {
char *tempfile;
if ((*ctp)->c_file) {
char *tempfile;
if (ctinit) {
char *cte = concat (" ", ce, "\n", NULL);
if (ctinit) {
char *cte = concat (" ", ce, "\n", NULL);
+ bool found_cte = false;
HF hf;
/* Decoded contents might be in ct->c_cefile.ce_file, if the
caller is decode_text_parts (). Save because we'll
HF hf;
/* Decoded contents might be in ct->c_cefile.ce_file, if the
caller is decode_text_parts (). Save because we'll
/* Update/add Content-Transfer-Encoding header field. */
for (hf = ct->c_first_hf; hf; hf = hf->next) {
if (! strcasecmp (ENCODING_FIELD, hf->name)) {
/* Update/add Content-Transfer-Encoding header field. */
for (hf = ct->c_first_hf; hf; hf = hf->next) {
if (! strcasecmp (ENCODING_FIELD, hf->name)) {
free (hf->value);
hf->value = cte;
}
free (hf->value);
hf->value = cte;
}
int *new_subpart_number) {
struct multipart *mp = (struct multipart *) parent->c_ctparams;
struct part *part, *prev;
int *new_subpart_number) {
struct multipart *mp = (struct multipart *) parent->c_ctparams;
struct part *part, *prev;
- int has_text_plain = 0;
+ bool has_text_plain = false;
for (prev = part = mp->mp_parts; part; part = part->mp_next) {
++*new_subpart_number;
for (prev = part = mp->mp_parts; part; part = part->mp_next) {
++*new_subpart_number;
free_content (old_part->mp_part);
free (old_part);
} else {
free_content (old_part->mp_part);
free (old_part);
} else {
boundary_in_content (FILE **fp, char *file, const char *boundary) {
char buffer[NMH_BUFSIZ];
size_t bytes_read;
boundary_in_content (FILE **fp, char *file, const char *boundary) {
char buffer[NMH_BUFSIZ];
size_t bytes_read;
- int found_boundary = 0;
+ bool found_boundary = false;
/* free_content() will close *fp if we fopen it here. */
if (! *fp && (*fp = fopen (file, "r")) == NULL) {
/* free_content() will close *fp if we fopen it here. */
if (! *fp && (*fp = fopen (file, "r")) == NULL) {
fseeko (*fp, 0L, SEEK_SET);
while ((bytes_read = fread (buffer, 1, sizeof buffer, *fp)) > 0) {
if (find_str (buffer, bytes_read, boundary)) {
fseeko (*fp, 0L, SEEK_SET);
while ((bytes_read = fread (buffer, 1, sizeof buffer, *fp)) > 0) {
if (find_str (buffer, bytes_read, boundary)) {
char *type_subtypename = concat (" ", typename, "/", subtypename, NULL);
/* E.g, " text/plain\n" */
char *name_plus_nl = concat (type_subtypename, "\n", NULL);
char *type_subtypename = concat (" ", typename, "/", subtypename, NULL);
/* E.g, " text/plain\n" */
char *name_plus_nl = concat (type_subtypename, "\n", NULL);
- int found_content_type = 0;
+ bool found_content_type = false;
HF hf;
const char *cp = NULL;
char *ctline;
HF hf;
const char *cp = NULL;
char *ctline;
/* Update/add Content-Type header field. */
for (hf = ct->c_first_hf; hf; hf = hf->next) {
if (! strcasecmp (TYPE_FIELD, hf->name)) {
/* Update/add Content-Type header field. */
for (hf = ct->c_first_hf; hf; hf = hf->next) {
if (! strcasecmp (TYPE_FIELD, hf->name)) {
- found_content_type = 1;
+ found_content_type = true;
free (hf->value);
hf->value = (cp = strchr (ct->c_ctline, ';'))
? concat (type_subtypename, cp, "\n", NULL)
free (hf->value);
hf->value = (cp = strchr (ct->c_ctline, ';'))
? concat (type_subtypename, cp, "\n", NULL)
decodetypes with commas, then search for ,type, and ,type/subtype, in
it. */
decodetypes with commas, then search for ,type, and ,type/subtype, in
it. */
+ bool found_match = false;
char *delimited_decodetypes = concat(",", decodetypes, ",", NULL);
char *delimited_type = concat(",", type, ",", NULL);
if (nmh_strcasestr(delimited_decodetypes, delimited_type)) {
char *delimited_decodetypes = concat(",", decodetypes, ",", NULL);
char *delimited_type = concat(",", type, ",", NULL);
if (nmh_strcasestr(delimited_decodetypes, delimited_type)) {
} else if (subtype != NULL) {
char *delimited_type_subtype =
concat(",", type, "/", subtype, ",", NULL);
if (nmh_strcasestr(delimited_decodetypes, delimited_type_subtype)) {
} else if (subtype != NULL) {
char *delimited_type_subtype =
concat(",", type, "/", subtype, ",", NULL);
if (nmh_strcasestr(delimited_decodetypes, delimited_type_subtype)) {
}
free(delimited_type_subtype);
}
}
free(delimited_type_subtype);
}
FILE **fp = NULL;
size_t begin;
size_t end;
FILE **fp = NULL;
size_t begin;
size_t end;
- int has_crs = 0;
- int opened_input_file = 0;
+ bool has_crs = false;
+ bool opened_input_file = false;
if (ct->c_cefile.ce_file) {
file = &ct->c_cefile.ce_file;
if (ct->c_cefile.ce_file) {
file = &ct->c_cefile.ce_file;
advise (*file, "unable to open for reading");
status = NOTOK;
} else {
advise (*file, "unable to open for reading");
status = NOTOK;
} else {
+ opened_input_file = true;
modify the content. */
char *cp;
size_t i;
modify the content. */
char *cp;
size_t i;
- int last_char_was_cr = 0;
+ bool last_char_was_cr = false;
if (end > 0) { bytes_to_read -= bytes_read; }
for (i = 0, cp = buffer; i < bytes_read; ++i, ++cp) {
if (*cp == '\n' && last_char_was_cr) {
if (end > 0) { bytes_to_read -= bytes_read; }
for (i = 0, cp = buffer; i < bytes_read; ++i, ++cp) {
if (*cp == '\n' && last_char_was_cr) {
- int last_char_was_cr = 0;
+ bool last_char_was_cr = false;
for (i = 0, cp = buffer; i < bytes_read; ++i, ++cp) {
if (*cp == '\r') {
for (i = 0, cp = buffer; i < bytes_read; ++i, ++cp) {
if (*cp == '\r') {
+ last_char_was_cr = true;
} else if (last_char_was_cr) {
if (*cp != '\n') {
if (write (fd, "\r", 1) < 0) {
} else if (last_char_was_cr) {
if (*cp != '\n') {
if (write (fd, "\r", 1) < 0) {
if (write (fd, cp, 1) < 0) {
advise (tempfile, "write");
}
if (write (fd, cp, 1) < 0) {
advise (tempfile, "write");
}
+ last_char_was_cr = false;
} else {
if (write (fd, cp, 1) < 0) {
advise (tempfile, "write");
}
} else {
if (write (fd, cp, 1) < 0) {
advise (tempfile, "write");
}
+ last_char_was_cr = false;
least_restrictive_enc != CE_7BIT) {
char *cte = concat (" ", ce_str (least_restrictive_enc), "\n", NULL);
HF hf;
least_restrictive_enc != CE_7BIT) {
char *cte = concat (" ", ce_str (least_restrictive_enc), "\n", NULL);
HF hf;
+ bool found_cte = false;
/* Update/add Content-Transfer-Encoding header field. */
for (hf = ct->c_first_hf; hf; hf = hf->next) {
if (! strcasecmp (ENCODING_FIELD, hf->name)) {
/* Update/add Content-Transfer-Encoding header field. */
for (hf = ct->c_first_hf; hf; hf = hf->next) {
if (! strcasecmp (ENCODING_FIELD, hf->name)) {
free (hf->value);
hf->value = cte;
}
free (hf->value);
hf->value = cte;
}
*/
static int
fix_filename_param (char *name, char *value, PM *first_pm, PM *last_pm) {
*/
static int
fix_filename_param (char *name, char *value, PM *first_pm, PM *last_pm) {
if (has_prefix(value, "=?") && has_suffix(value, "?=")) {
/* Looks like an RFC 2047 encoded parameter. */
if (has_prefix(value, "=?") && has_suffix(value, "?=")) {
/* Looks like an RFC 2047 encoded parameter. */
if (decode_rfc2047 (value, decoded, sizeof decoded)) {
/* Encode using RFC 2231. */
replace_param (first_pm, last_pm, name, decoded, 0);
if (decode_rfc2047 (value, decoded, sizeof decoded)) {
/* Encode using RFC 2231. */
replace_param (first_pm, last_pm, name, decoded, 0);
} else {
inform("failed to decode %s parameter %s", name, value);
}
} else {
inform("failed to decode %s parameter %s", name, value);
}
act action = ACT_NONE;
char *infile = NULL, *outfile = NULL;
FILE *inputfile = NULL, *outputfile = NULL;
act action = ACT_NONE;
char *infile = NULL, *outfile = NULL;
FILE *inputfile = NULL, *outputfile = NULL;
- int contenttype = 0, unfold = 0;
+ bool contenttype = false;
+ bool unfold = false;
vevent *v, *nextvevent;
char *form = "mhical.24hour", *format = NULL;
char **argp, **arguments, *cp;
vevent *v, *nextvevent;
char *form = "mhical.24hour", *format = NULL;
char **argp, **arguments, *cp;
continue;
case CONTENTTYPESW:
continue;
case CONTENTTYPESW:
continue;
case NCONTENTTYPESW:
continue;
case NCONTENTTYPESW:
static void
convert_to_reply (contentline *clines, act action) {
char *partstat = NULL;
static void
convert_to_reply (contentline *clines, act action) {
char *partstat = NULL;
- int found_my_attendee_line = 0;
+ bool found_my_attendee_line = false;
contentline *node;
convert_common (clines, action);
contentline *node;
convert_common (clines, action);
while (getname ("")) { continue; }
if (ismymbox (mn)) {
while (getname ("")) { continue; }
if (ismymbox (mn)) {
- found_my_attendee_line = 1;
+ found_my_attendee_line = true;
for (p = node->params; p && p->param_name; p = p->next) {
value_list *v;
for (p = node->params; p && p->param_name; p = p->next) {
value_list *v;
static void
convert_common (contentline *clines, act action) {
contentline *node;
static void
convert_common (contentline *clines, act action) {
contentline *node;
if ((node = find_contentline (clines, "METHOD", 0))) {
free (node->value);
if ((node = find_contentline (clines, "METHOD", 0))) {
free (node->value);
}
/* Excise X- lines and VALARM section(s). */
}
/* Excise X- lines and VALARM section(s). */
for (node = clines; node; node = node->next) {
/* node->name will be NULL if the line was deleted. */
if (! node->name) { continue; }
for (node = clines; node; node = node->next) {
/* node->name will be NULL if the line was deleted. */
if (! node->name) { continue; }
if (in_valarm) {
if (! strcasecmp ("END", node->name) &&
! strcasecmp ("VALARM", node->value)) {
if (in_valarm) {
if (! strcasecmp ("END", node->name) &&
! strcasecmp ("VALARM", node->value)) {
}
remove_contentline (node);
} else {
if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("VALARM", node->value)) {
}
remove_contentline (node);
} else {
if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("VALARM", node->value)) {
remove_contentline (node);
} else if (! strncasecmp ("X-", node->name, 2)) {
remove_contentline (node);
remove_contentline (node);
} else if (! strncasecmp ("X-", node->name, 2)) {
remove_contentline (node);
static void
display (FILE *file, contentline *clines, char *nfs) {
tzdesc_t timezones = load_timezones (clines);
static void
display (FILE *file, contentline *clines, char *nfs) {
tzdesc_t timezones = load_timezones (clines);
- int in_vtimezone;
- int in_valarm;
+ bool in_vtimezone;
+ bool in_valarm;
contentline *node;
struct format *fmt;
int dat[5] = { 0, 0, 0, INT_MAX, 0 };
contentline *node;
struct format *fmt;
int dat[5] = { 0, 0, 0, INT_MAX, 0 };
}
/* Only display DESCRIPTION lines that are outside VALARM section(s). */
}
/* Only display DESCRIPTION lines that are outside VALARM section(s). */
if ((c = fmt_findcomp ("description"))) {
for (node = clines; node; node = node->next) {
/* node->name will be NULL if the line was deleted. */
if ((c = fmt_findcomp ("description"))) {
for (node = clines; node; node = node->next) {
/* node->name will be NULL if the line was deleted. */
} else if (in_valarm) {
if (! strcasecmp ("END", node->name) &&
! strcasecmp ("VALARM", node->value)) {
} else if (in_valarm) {
if (! strcasecmp ("END", node->name) &&
! strcasecmp ("VALARM", node->value)) {
}
} else {
if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("VALARM", node->value)) {
}
} else {
if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("VALARM", node->value)) {
if ((c = fmt_findcomp ("dtstart"))) {
/* Find DTSTART outsize of a VTIMEZONE section. */
if ((c = fmt_findcomp ("dtstart"))) {
/* Find DTSTART outsize of a VTIMEZONE section. */
for (node = clines; node; node = node->next) {
/* node->name will be NULL if the line was deleted. */
if (! node->name) { continue; }
for (node = clines; node; node = node->next) {
/* node->name will be NULL if the line was deleted. */
if (! node->name) { continue; }
if (in_vtimezone) {
if (! strcasecmp ("END", node->name) &&
! strcasecmp ("VTIMEZONE", node->value)) {
if (in_vtimezone) {
if (! strcasecmp ("END", node->name) &&
! strcasecmp ("VTIMEZONE", node->value)) {
}
} else {
if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("VTIMEZONE", node->value)) {
}
} else {
if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("VTIMEZONE", node->value)) {
} else if (! strcasecmp ("DTSTART", node->name)) {
/* Got it: DTSTART outside of a VTIMEZONE section. */
char *datetime = format_datetime (timezones, node);
} else if (! strcasecmp ("DTSTART", node->name)) {
/* Got it: DTSTART outside of a VTIMEZONE section. */
char *datetime = format_datetime (timezones, node);
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
- int sizesw = 1, headsw = 1, chgflag = 1, verbosw = 0, dispo = 0;
+ bool sizesw = true;
+ bool headsw = true;
+ int chgflag = 1;
+ bool verbosw = false;
+ bool dispo = false;
int msgnum, *icachesw;
char *cp, *file = NULL, *folder = NULL;
char *maildir, buf[100], **argp;
int msgnum, *icachesw;
char *cp, *file = NULL, *folder = NULL;
char *maildir, buf[100], **argp;
continue;
case DEBUGSW:
debugsw = 1;
continue;
case DEBUGSW:
debugsw = 1;
static int bellflg = 0;
static int clearflg = 0;
static int dashstuff = 0;
static int bellflg = 0;
static int clearflg = 0;
static int dashstuff = 0;
+static bool dobody = true;
static int forwflg = 0;
static int forwall = 0;
static int forwflg = 0;
static int forwall = 0;
/*
* variables for mhbuild (mhn -build)
*/
/*
* variables for mhbuild (mhn -build)
*/
static int rfc934sw = 0;
/*
* what action to take?
*/
static int cachesw = 0;
static int rfc934sw = 0;
/*
* what action to take?
*/
static int cachesw = 0;
-static int listsw = 0;
-static int showsw = 0;
-static int storesw = 0;
+static bool listsw;
+static bool showsw;
+static bool storesw;
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
- int sizesw = 1, headsw = 1, autosw = 0;
+ bool sizesw = true;
+ bool headsw = true;
+ int autosw = 0;
int msgnum, *icachesw;
char *cp, *file = NULL, *folder = NULL;
char *maildir, buf[100], **argp;
int msgnum, *icachesw;
char *cp, *file = NULL, *folder = NULL;
char *maildir, buf[100], **argp;
* Switches for mhbuild
*/
case BUILDSW:
* Switches for mhbuild
*/
case BUILDSW:
continue;
case RFC934SW:
rfc934sw = 1;
continue;
case RFC934SW:
rfc934sw = 1;
/* If no action is specified, assume -show */
if (!listsw && !showsw && !storesw && !cachesw)
/* If no action is specified, assume -show */
if (!listsw && !showsw && !storesw && !cachesw)
userrs = 1;
SIGNAL (SIGQUIT, quitser);
userrs = 1;
SIGNAL (SIGQUIT, quitser);
static char *datalocking = "fcntl";
static char *localmbox = "";
static char *datalocking = "fcntl";
static char *localmbox = "";
-static int localmbox_primed = 0;
+static bool localmbox_primed;
extern char *spoollocking;
extern char *spoollocking;
{
int i, compp = 0;
bool missed;
{
int i, compp = 0;
bool missed;
- int all = 0, debug = 0;
+ bool all = false;
+ bool debug = false;
int components = -1;
char *cp, buf[BUFSIZ], **argp;
char **arguments, *comps[MAXARGS];
int components = -1;
char *cp, buf[BUFSIZ], **argp;
char **arguments, *comps[MAXARGS];
break;
}
} else {
comps[compp++] = cp;
if (strcmp("localmbox", cp) == 0 && ! localmbox_primed) {
localmbox = getlocalmbox();
break;
}
} else {
comps[compp++] = cp;
if (strcmp("localmbox", cp) == 0 && ! localmbox_primed) {
localmbox = getlocalmbox();
+ localmbox_primed = true;
/* Also set localmbox here */
if (! localmbox_primed) {
localmbox = getlocalmbox();
/* Also set localmbox here */
if (! localmbox_primed) {
localmbox = getlocalmbox();
+ localmbox_primed = true;
static int
InitMultiPart (CT ct)
{
static int
InitMultiPart (CT ct)
{
long last, pos;
char *cp, *dp;
PM pm;
long last, pos;
char *cp, *dp;
PM pm;
last = ct->c_end;
next = &m->mp_parts;
part = NULL;
last = ct->c_end;
next = &m->mp_parts;
part = NULL;
while ((gotlen = getline(&bufp, &buflen, fp)) != -1) {
if (pos > last)
while ((gotlen = getline(&bufp, &buflen, fp)) != -1) {
if (pos > last)
part->mp_part = p;
pos = p->c_begin;
fseek (fp, pos, SEEK_SET);
part->mp_part = p;
pos = p->c_begin;
fseek (fp, pos, SEEK_SET);
} else {
if (strcmp (bufp + 2, m->mp_start) == 0) {
} else {
if (strcmp (bufp + 2, m->mp_start) == 0) {
end_part:
p = part->mp_part;
p->c_end = ftell(fp) - (gotlen + 1);
end_part:
p = part->mp_part;
p->c_end = ftell(fp) - (gotlen + 1);
openBase64 (CT ct, char **file)
{
ssize_t cc, len;
openBase64 (CT ct, char **file)
{
ssize_t cc, len;
+ int fd;
+ bool own_ct_fp = false;
char *cp, *buffer = NULL;
/* sbeck -- handle suffixes */
CI ci;
char *cp, *buffer = NULL;
/* sbeck -- handle suffixes */
CI ci;
content_error (ct->c_file, ct, "unable to open for reading");
return NOTOK;
}
content_error (ct->c_file, ct, "unable to open for reading");
return NOTOK;
}
}
lseek (fd = fileno (ct->c_fp), (off_t) ct->c_begin, SEEK_SET);
}
lseek (fd = fileno (ct->c_fp), (off_t) ct->c_begin, SEEK_SET);
static int
openQuoted (CT ct, char **file)
{
static int
openQuoted (CT ct, char **file)
{
- int cc, digested, len, quoted, own_ct_fp = 0;
+ int cc, digested, len, quoted;
+ bool own_ct_fp = false;
char *cp, *ep;
char *bufp = NULL;
size_t buflen;
char *cp, *ep;
char *bufp = NULL;
size_t buflen;
content_error (ct->c_file, ct, "unable to open for reading");
return NOTOK;
}
content_error (ct->c_file, ct, "unable to open for reading");
return NOTOK;
}
}
if ((digested = ct->c_digested))
}
if ((digested = ct->c_digested))
int
open7Bit (CT ct, char **file)
{
int
open7Bit (CT ct, char **file)
{
- int cc, fd, len, own_ct_fp = 0;
+ int cc, fd, len;
+ bool own_ct_fp = false;
char buffer[BUFSIZ];
/* sbeck -- handle suffixes */
char *cp;
char buffer[BUFSIZ];
/* sbeck -- handle suffixes */
char *cp;
content_error (ct->c_file, ct, "unable to open for reading");
return NOTOK;
}
content_error (ct->c_file, ct, "unable to open for reading");
return NOTOK;
}
}
lseek (fd = fileno (ct->c_fp), (off_t) ct->c_begin, SEEK_SET);
}
lseek (fd = fileno (ct->c_fp), (off_t) ct->c_begin, SEEK_SET);
static int
openFTP (CT ct, char **file)
{
static int
openFTP (CT ct, char **file)
{
- int cachetype, caching, fd;
+ int cachetype;
+ bool caching;
+ int fd;
int len, buflen;
char *bp, *ftp, *user, *pass;
char buffer[BUFSIZ], cachefile[BUFSIZ];
int len, buflen;
char *bp, *ftp, *user, *pass;
char buffer[BUFSIZ], cachefile[BUFSIZ];
}
ce->ce_unlink = (*file == NULL);
}
ce->ce_unlink = (*file == NULL);
cachefile[0] = '\0';
if ((!e->eb_permission || strcasecmp (e->eb_permission, "read-write"))
&& find_cache (NULL, wcachesw, &cachetype, e->eb_content->c_id,
cachefile, sizeof(cachefile)) != NOTOK) {
if (*file == NULL) {
ce->ce_unlink = 0;
cachefile[0] = '\0';
if ((!e->eb_permission || strcasecmp (e->eb_permission, "read-write"))
&& find_cache (NULL, wcachesw, &cachetype, e->eb_content->c_id,
cachefile, sizeof(cachefile)) != NOTOK) {
if (*file == NULL) {
ce->ce_unlink = 0;
CE ce = &ct->c_cefile;
char *urlprog, *program;
char buffer[BUFSIZ], cachefile[BUFSIZ];
CE ce = &ct->c_cefile;
char *urlprog, *program;
char buffer[BUFSIZ], cachefile[BUFSIZ];
- int fd, caching, cachetype;
+ int fd;
+ bool caching;
+ int cachetype;
struct msgs_array args = { 0, 0, NULL};
pid_t child_id;
struct msgs_array args = { 0, 0, NULL};
pid_t child_id;
}
ce->ce_unlink = (*file == NULL);
}
ce->ce_unlink = (*file == NULL);
cachefile[0] = '\0';
if (find_cache(NULL, wcachesw, &cachetype, e->eb_content->c_id,
cachefile, sizeof(cachefile)) != NOTOK) {
if (*file == NULL) {
ce->ce_unlink = 0;
cachefile[0] = '\0';
if (find_cache(NULL, wcachesw, &cachetype, e->eb_content->c_id,
cachefile, sizeof(cachefile)) != NOTOK) {
if (*file == NULL) {
ce->ce_unlink = 0;
{
struct multipart *m = (struct multipart *) ct->c_ctparams;
char *boundary;
{
struct multipart *m = (struct multipart *) ct->c_ctparams;
char *boundary;
- int found_boundary = 0;
+ bool found_boundary = false;
int max = BUFSIZ;
char *bufp = NULL;
size_t buflen;
int max = BUFSIZ;
char *bufp = NULL;
size_t buflen;
if (before) {
if (! strcmp (bufp, boundary)) {
if (before) {
if (! strcmp (bufp, boundary)) {
}
} else {
if (! found_boundary && ! strcmp (bufp, boundary)) {
}
} else {
if (! found_boundary && ! strcmp (bufp, boundary)) {
while (*cp == ';') {
char *dp, *vp, *up, *nameptr, *valptr, *charset = NULL, *lang = NULL;
while (*cp == ';') {
char *dp, *vp, *up, *nameptr, *valptr, *charset = NULL, *lang = NULL;
- int encoded = 0, partial = 0, len = 0, index = 0;
+ bool encoded = false;
+ bool partial = false;
+ int len = 0, index = 0;
cp++;
while (isspace ((unsigned char) *cp))
cp++;
while (isspace ((unsigned char) *cp))
for (vp = cp; vp < up; vp++) {
if (*vp == '*' && vp < up - 1) {
for (vp = cp; vp < up; vp++) {
if (*vp == '*' && vp < up - 1) {
continue;
}
if (*vp == '*' && vp == up - 1) {
continue;
}
if (*vp == '*' && vp == up - 1) {
} else if (partial) {
if (isdigit((unsigned char) *vp))
index = *vp - '0' + index * 10;
} else if (partial) {
if (isdigit((unsigned char) *vp))
index = *vp - '0' + index * 10;
int alternating, nowalternate, result;
struct multipart *m = (struct multipart *) ct->c_ctparams;
struct part *part;
int alternating, nowalternate, result;
struct multipart *m = (struct multipart *) ct->c_ctparams;
struct part *part;
- int request_matched;
- int display_success;
- int mult_alt_done;
+ bool request_matched;
+ bool display_success;
+ bool mult_alt_done;
- request_matched = 0;
- display_success = 0;
- mult_alt_done = 0;
+ request_matched = false;
+ display_success = false;
+ mult_alt_done = false;
for (part = m->mp_parts; part; part = part->mp_next) {
p = part->mp_part;
for (part = m->mp_parts; part; part = part->mp_next) {
p = part->mp_part;
inlineonly, fmt);
switch (inneresult) {
case NOTOK: /* hard display error */
inlineonly, fmt);
switch (inneresult) {
case NOTOK: /* hard display error */
+ request_matched = true;
if (alternate && !alternating) {
result = NOTOK;
goto out;
if (alternate && !alternating) {
result = NOTOK;
goto out;
continue;
case OK: /* display successful */
continue;
case OK: /* display successful */
- request_matched = 1;
- display_success = 1;
+ request_matched = true;
+ display_success = true;
result = OK;
/* if we got success on a sub-part of
result = OK;
/* if we got success on a sub-part of
* there's a chance an explicit part should be
* matched later in the alternatives. */
if (alternating) {
* there's a chance an explicit part should be
* matched later in the alternatives. */
if (alternating) {
} else if (alternate) {
alternate = nowalternate = 0;
}
} else if (alternate) {
alternate = nowalternate = 0;
}
parse_display_string (CT ct, char *cp, int *xstdin, int *xlist,
char *file, char *buffer, size_t buflen,
int multipart) {
parse_display_string (CT ct, char *cp, int *xstdin, int *xlist,
char *file, char *buffer, size_t buflen,
int multipart) {
+ int len;
+ bool quoted = false;
char *bp = buffer, *pp;
CI ci = &ct->c_ctinfo;
char *bp = buffer, *pp;
CI ci = &ct->c_ctinfo;
*pp++ = '\'';
buflen--;
bp++;
*pp++ = '\'';
buflen--;
bp++;
}
/* Escape existing quotes */
while ((pp = strchr (pp, '\'')) && buflen > 3) {
}
/* Escape existing quotes */
while ((pp = strchr (pp, '\'')) && buflen > 3) {
*pp++ = '\'';
buflen -= 2;
bp += 2;
*pp++ = '\'';
buflen -= 2;
bp += 2;
} else {
/* Not quoted. This should not be reached with
the current code, but handle the condition
} else {
/* Not quoted. This should not be reached with
the current code, but handle the condition
if (! found_quote) {
*bp++ = '\'';
buflen--;
if (! found_quote) {
*bp++ = '\'';
buflen--;
FILE **fp = NULL;
size_t begin;
size_t end;
FILE **fp = NULL;
size_t begin;
size_t end;
- int opened_input_file = 0;
+ bool opened_input_file = false;
char src_buffer[BUFSIZ];
size_t dest_buffer_size = BUFSIZ;
char *dest_buffer = mh_xmalloc(dest_buffer_size);
char src_buffer[BUFSIZ];
size_t dest_buffer_size = BUFSIZ;
char *dest_buffer = mh_xmalloc(dest_buffer_size);
advise (*file, "unable to open for reading");
status = NOTOK;
} else {
advise (*file, "unable to open for reading");
status = NOTOK;
} else {
+ opened_input_file = true;
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
+ int msgnum, *icachesw, autosw = 0;
/* verbosw defaults to 1 for backward compatibility. */
/* verbosw defaults to 1 for backward compatibility. */
- int msgnum, *icachesw, autosw = 0, verbosw = 1;
const char *clobbersw = "always";
char *cp, *file = NULL, *outfile = NULL, *folder = NULL;
char *maildir, buf[100], **argp;
const char *clobbersw = "always";
char *cp, *file = NULL, *outfile = NULL, *folder = NULL;
char *maildir, buf[100], **argp;
continue;
case CLOBBERSW:
if (!(cp = *argp++) || *cp == '-')
continue;
case CLOBBERSW:
if (!(cp = *argp++) || *cp == '-')
* attribute/value pairs which specify if this a tar file.
*/
if (!ct->c_storeproc && ct->c_subtype == APPLICATION_OCTETS) {
* attribute/value pairs which specify if this a tar file.
*/
if (!ct->c_storeproc && ct->c_subtype == APPLICATION_OCTETS) {
- int tarP = 0, zP = 0, gzP = 0;
+ bool tarP = false;
+ bool zP = false;
+ bool gzP = false;
char *cp;
if ((cp = get_param(ci->ci_first_pm, "type", ' ', 1))) {
if (strcasecmp (cp, "tar") == 0)
char *cp;
if ((cp = get_param(ci->ci_first_pm, "type", ' ', 1))) {
if (strcasecmp (cp, "tar") == 0)
}
/* check for "conversions=compress" attribute */
}
/* check for "conversions=compress" attribute */
(cp = get_param(ci->ci_first_pm, "x-conversions", ' ', 1))) {
if (strcasecmp (cp, "compress") == 0 ||
strcasecmp (cp, "x-compress") == 0) {
(cp = get_param(ci->ci_first_pm, "x-conversions", ' ', 1))) {
if (strcasecmp (cp, "compress") == 0 ||
strcasecmp (cp, "x-compress") == 0) {
}
if (strcasecmp (cp, "gzip") == 0 ||
strcasecmp (cp, "x-gzip") == 0) {
}
if (strcasecmp (cp, "gzip") == 0 ||
strcasecmp (cp, "x-gzip") == 0) {
static int
store_content (CT ct, CT p, mhstoreinfo_t info)
{
static int
store_content (CT ct, CT p, mhstoreinfo_t info)
{
- int appending = 0, msgnum = 0;
- int is_partial = 0, first_partial = 0;
- int last_partial = 0;
+ bool appending = false;
+ int msgnum = 0;
+ bool is_partial = false;
+ bool first_partial = false;
+ bool last_partial = false;
char *cp, buffer[BUFSIZ];
/*
char *cp, buffer[BUFSIZ];
/*
struct partial *pm = (struct partial *) ct->c_ctparams;
/* Yep, it's a message/partial */
struct partial *pm = (struct partial *) ct->c_ctparams;
/* Yep, it's a message/partial */
/* But is it the first and/or last in the collection? */
if (pm->pm_partno == 1)
/* But is it the first and/or last in the collection? */
if (pm->pm_partno == 1)
if (pm->pm_maxno && pm->pm_partno == pm->pm_maxno)
if (pm->pm_maxno && pm->pm_partno == pm->pm_maxno)
/*
* If "p" is a valid pointer, then it points to the
/*
* If "p" is a valid pointer, then it points to the
* from the previous iteration of this function.
*/
if (p) {
* from the previous iteration of this function.
*/
if (p) {
if (! ct->c_storage) {
ct->c_storage = mh_xstrdup(FENDNULL(p->c_storage));
if (! ct->c_storage) {
ct->c_storage = mh_xstrdup(FENDNULL(p->c_storage));
char *file;
char *cwd = NULL;
char *file;
char *cwd = NULL;
if (! strcmp (original_file, "-")) {
return original_file;
if (! strcmp (original_file, "-")) {
return original_file;
struct stat st;
file = original_file;
struct stat st;
file = original_file;
switch (info->clobber_policy) {
case NMH_CLOBBER_ALWAYS:
switch (info->clobber_policy) {
case NMH_CLOBBER_ALWAYS:
file = cwd ? concat (cwd, "/", buf, NULL) : mh_xstrdup(buf);
}
file = cwd ? concat (cwd, "/", buf, NULL) : mh_xstrdup(buf);
}
int personal, int snoop, int sasl, char *saslmech, int tls,
const char *auth_svc)
{
int personal, int snoop, int sasl, char *saslmech, int tls,
const char *auth_svc)
{
- int nmsgs, nbytes, status;
+ int nmsgs, nbytes;
+ bool status;
if (auth_svc == NULL) {
if (saslmech && ! strcasecmp(saslmech, "xoauth2")) {
if (auth_svc == NULL) {
if (saslmech && ! strcasecmp(saslmech, "xoauth2")) {
} else {
if (notifysw & NT_NMAI)
printf (personal ? "You don't %s%s" : "%s doesn't %s",
personal ? "" : user, "have any mail waiting");
else
notifysw = 0;
} else {
if (notifysw & NT_NMAI)
printf (personal ? "You don't %s%s" : "%s doesn't %s",
personal ? "" : user, "have any mail waiting");
else
notifysw = 0;
}
if (notifysw)
printf (" on %s\n", host);
}
if (notifysw)
printf (" on %s\n", host);
struct msgs *mp, *mp2;
FILE *fp;
int debug = 0;
struct msgs *mp, *mp2;
FILE *fp;
int debug = 0;
int start, end, inc;
if (nmh_init(argv[0], true, true)) { return 1; }
int start, end, inc;
if (nmh_init(argv[0], true, true)) { return 1; }
static int badadr = 0; /* number of bad addrs */
static int badmsg = 0; /* message has bad semantics */
static int verbose = 0; /* spell it out */
static int badadr = 0; /* number of bad addrs */
static int badmsg = 0; /* message has bad semantics */
static int verbose = 0; /* spell it out */
-static int format = 1; /* format addresses */
+static bool format = true; /* format addresses */
static int mime = 0; /* use MIME-style encapsulations for Bcc */
static int msgid = 0; /* add msgid */
static int debug = 0; /* debugging post */
static int mime = 0; /* use MIME-style encapsulations for Bcc */
static int msgid = 0; /* add msgid */
static int debug = 0; /* debugging post */
continue;
case BITSTUFFSW:
continue;
case BITSTUFFSW:
putadr (char *name, char *aka, struct mailname *mp, FILE *out,
unsigned int flags, char *savehdr, unsigned int savehdrsize)
{
putadr (char *name, char *aka, struct mailname *mp, FILE *out,
unsigned int flags, char *savehdr, unsigned int savehdrsize)
{
- int len, saveappend = 0;
+ int len;
+ bool saveappend = false;
unsigned int shlen;
char *cp;
char buffer[BUFSIZ];
unsigned int shlen;
char *cp;
char buffer[BUFSIZ];
if (savehdr) {
shlen = strlen(savehdr);
if (savehdr) {
shlen = strlen(savehdr);
}
if (*aka && mp->m_type != UUCPHOST && !mp->m_pers)
}
if (*aka && mp->m_type != UUCPHOST && !mp->m_pers)
fprintf (out, ",\n%*s", linepos = nameoutput, "");
if (saveappend) {
if (shlen + 2 + nameoutput + len >= savehdrsize) {
fprintf (out, ",\n%*s", linepos = nameoutput, "");
if (saveappend) {
if (shlen + 2 + nameoutput + len >= savehdrsize) {
} else {
snprintf(savehdr + shlen, savehdrsize - shlen, ",\n%*s",
linepos, "");
} else {
snprintf(savehdr + shlen, savehdrsize - shlen, ",\n%*s",
linepos, "");
linepos += 2;
if (saveappend) {
if (shlen + 2 + len >= savehdrsize) {
linepos += 2;
if (saveappend) {
if (shlen + 2 + len >= savehdrsize) {
} else {
strncat(savehdr, ", ", savehdrsize - shlen);
}
} else {
strncat(savehdr, ", ", savehdrsize - shlen);
}
static struct termios tio;
static struct termios tio;
static int sigint = 0;
static jmp_buf sigenv;
static int sigint = 0;
static jmp_buf sigenv;
- static int quoting = 0;
*buffer = 0;
switch (setjmp (sigenv)) {
case OK:
*buffer = 0;
switch (setjmp (sigenv)) {
case OK:
for (;;) {
switch (c = getchar ()) {
case EOF:
for (;;) {
switch (c = getchar ()) {
case EOF:
clearerr (stdin);
longjmp (sigenv, DONE);
case '\n':
if (quoting) {
*(cp - 1) = c;
clearerr (stdin);
longjmp (sigenv, DONE);
case '\n':
if (quoting) {
*(cp - 1) = c;
- quoting = 0;
- wtuser = 0;
+ quoting = false;
+ wtuser = false;
return 1;
}
*cp++ = c;
*cp = 0;
return 1;
}
*cp++ = c;
*cp = 0;
return 0;
default:
if (c == QUOTE) {
return 0;
default:
if (c == QUOTE) {
}
if (cp < buffer + n)
*cp++ = c;
}
if (cp < buffer + n)
*cp++ = c;
main (int argc, char **argv)
{
int publicsw = -1, zerosw = 0;
main (int argc, char **argv)
{
int publicsw = -1, zerosw = 0;
- int create = 1, unseensw = 1;
+ int create = 1;
+ bool unseensw = true;
int fd, msgnum;
size_t seqp = 0;
char *cp, *maildir, *folder = NULL, buf[BUFSIZ];
int fd, msgnum;
size_t seqp = 0;
char *cp, *maildir, *folder = NULL, buf[BUFSIZ];
continue;
case NUNSEENSW:
continue;
case NUNSEENSW:
#undef X
static jmp_buf myctx;
#undef X
static jmp_buf myctx;
-static int bell = 1;
-static int newline = 1;
-static int biff = 0;
+static bool bell = true;
+static bool newline = true;
+static bool biff;
static int width = -1;
static char *form = NULL;
static char *format = NULL;
static int width = -1;
static char *form = NULL;
static char *format = NULL;
width = atoi(cp);
continue;
case NLSW:
width = atoi(cp);
continue;
case NLSW:
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
- int linkf = 0, preserve = 0, retainseqs = 0, filep = 0;
+ int linkf = 0, preserve = 0;
+ bool retainseqs = false;
+ int filep = 0;
int foldp = 0, isdf = 0, unlink_msgs = 0;
int i, msgnum;
char *cp, *folder = NULL, buf[BUFSIZ];
int foldp = 0, isdf = 0, unlink_msgs = 0;
int i, msgnum;
char *cp, *folder = NULL, buf[BUFSIZ];
continue;
case RETAINSEQSSW:
continue;
case RETAINSEQSSW:
continue;
case NRETAINSEQSSW:
continue;
case NRETAINSEQSSW:
main (int argc, char **argv)
{
int i, isdf = 0;
main (int argc, char **argv)
{
int i, isdf = 0;
- int anot = 0, inplace = 1;
+ int anot = 0;
+ bool inplace = true;
int nedit = 0, nwhat = 0;
int atfile = 0;
int fmtproc = -1;
int nedit = 0, nwhat = 0;
int atfile = 0;
int fmtproc = -1;
static char *dfhost = NULL;
static struct mailname mq;
static char *dfhost = NULL;
static struct mailname mq;
-static int nodupcheck = 0; /* If set, no check for duplicates */
+static bool nodupcheck; /* If set, no check for duplicates */
static char *addrcomps[] = {
"from",
static char *addrcomps[] = {
"from",
cp = replformataddr(orig, str);
cp = replformataddr(orig, str);
char *
fix_addresses (char *str) {
char *fixed_str = NULL;
char *
fix_addresses (char *str) {
char *fixed_str = NULL;
+ bool fixed_address = false;
adr = getname (new_adr);
if (adr != NULL &&
(mp = getm (adr, dfhost, dftype, NULL, 0)) != NULL) {
adr = getname (new_adr);
if (adr != NULL &&
(mp = getm (adr, dfhost, dftype, NULL, 0)) != NULL) {
mnfree (mp);
}
free (angle_addr);
mnfree (mp);
}
free (angle_addr);
int width = -1, revflag = 0;
int i, state, msgnum;
ivector_t seqnum = ivector_create (0);
int width = -1, revflag = 0;
int i, state, msgnum;
ivector_t seqnum = ivector_create (0);
- int unseen, num_unseen_seq = 0;
+ bool unseen;
+ int num_unseen_seq = 0;
char *cp, *maildir, *file = NULL, *folder = NULL;
char *form = NULL, *format = NULL, buf[BUFSIZ];
char **argp, *nfs, **arguments;
char *cp, *maildir, *file = NULL, *folder = NULL;
char *form = NULL, *format = NULL, buf[BUFSIZ];
char **argp, *nfs, **arguments;
* Check if message is in any sequence given
* by Unseen-Sequence profile entry.
*/
* Check if message is in any sequence given
* by Unseen-Sequence profile entry.
*/
for (i = 0; i < num_unseen_seq; i++) {
if (in_sequence(mp, ivector_at (seqnum, i), msgnum)) {
for (i = 0; i < num_unseen_seq; i++) {
if (in_sequence(mp, ivector_at (seqnum, i), msgnum)) {
int dat[5];
struct format *fmt;
struct stat st;
int dat[5];
struct format *fmt;
struct stat st;
m_getfld_state_t gstate;
charstring_t buffer = charstring_create(0);
char *retval;
m_getfld_state_t gstate;
charstring_t buffer = charstring_create(0);
char *retval;
* Read in the message and process the header.
*/
rewind (in);
* Read in the message and process the header.
*/
rewind (in);
gstate = m_getfld_state_init(in);
do {
char name[NAMESZ], rbuf[NMH_BUFSIZ];
gstate = m_getfld_state_init(in);
do {
char name[NAMESZ], rbuf[NMH_BUFSIZ];
+ parsing_header = false;
}
} while (parsing_header);
m_getfld_state_destroy(&gstate);
}
} while (parsing_header);
m_getfld_state_destroy(&gstate);
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
- int draftsw = 0, headersw = 1;
- int nshow = 0, checkmime = 1, mime = 0;
+ int draftsw = 0;
+ bool headersw = true;
+ int nshow = 0, checkmime = 1;
+ bool mime = false;
int isdf = 0, mode = SHOW, msgnum;
char *cp, *maildir, *file = NULL, *folder = NULL, *proc, *program;
char buf[BUFSIZ], **argp, **arguments;
int isdf = 0, mode = SHOW, msgnum;
char *cp, *maildir, *file = NULL, *folder = NULL, *proc, *program;
char buf[BUFSIZ], **argp, **arguments;
goto non_mhl_switches;
case NHEADSW:
goto non_mhl_switches;
case NHEADSW:
/* FALLTHRU */
case CONCATSW:
case NCONCATSW:
/* FALLTHRU */
case CONCATSW:
case NCONCATSW:
app_msgarg(&vec, mh_xstrdup(m_draft(folder, NULL, 1, &isdf)));
else
app_msgarg(&vec, file);
app_msgarg(&vec, mh_xstrdup(m_draft(folder, NULL, 1, &isdf)));
else
app_msgarg(&vec, file);
/* loop through selected messages and check for MIME */
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
if (is_selected (mp, msgnum) && is_nontext (m_name (msgnum))) {
/* loop through selected messages and check for MIME */
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
if (is_selected (mp, msgnum) && is_nontext (m_name (msgnum))) {
break;
}
} else {
/* check the file or draft for MIME */
if (is_nontext (vec.msgs[vec.size - 1]))
break;
}
} else {
/* check the file or draft for MIME */
if (is_nontext (vec.msgs[vec.size - 1]))
static int
usr_delivery (int fd, char *delivery, int su)
{
static int
usr_delivery (int fd, char *delivery, int su)
{
- int i, accept, status=1, won, vecp, next;
+ int i;
+ bool accept;
+ int status=1, won, vecp;
+ bool next;
char *field, *pattern, *action, *result, *string;
char buffer[BUFSIZ], tmpbuf[BUFSIZ];
char *vec[NVEC];
char *field, *pattern, *action, *result, *string;
char buffer[BUFSIZ], tmpbuf[BUFSIZ];
char *vec[NVEC];
/* read and process delivery file */
while (fgets (buffer, sizeof(buffer), fp)) {
/* read and process delivery file */
while (fgets (buffer, sizeof(buffer), fp)) {
* Take action, and consider delivered if
* action is successful.
*/
* Take action, and consider delivered if
* action is successful.
*/
* Take action, but don't consider delivered, even
* if action is successful
*/
* Take action, but don't consider delivered, even
* if action is successful
*/
*/
if ((p = lookup (hdrs, field)) && (p->p_value != NULL)
&& matches (p->p_value, pattern)) {
*/
if ((p = lookup (hdrs, field)) && (p->p_value != NULL)
&& matches (p->p_value, pattern)) {
- if (status) next = 0; /* action failed, mark for 'N' result */
+ if (status) next = false; /* action failed, mark for 'N' result */
if (accept && status == 0)
won++;
if (accept && status == 0)
won++;
struct msgs_array msgs = { 0, 0, NULL };
struct msgs *mp;
struct smsg **dlist;
struct msgs_array msgs = { 0, 0, NULL };
struct msgs *mp;
struct smsg **dlist;
if (nmh_init(argv[0], true, true)) { return 1; }
if (nmh_init(argv[0], true, true)) { return 1; }
* Attach files to current draft.
*/
* Attach files to current draft.
*/
char **ap;
if (checkmimeheader(drft))
char **ap;
if (checkmimeheader(drft))
for (ap = argp+1; *ap; ++ap) {
if (strcmp(*ap, "-v") == 0) {
++argp;
for (ap = argp+1; *ap; ++ap) {
if (strcmp(*ap, "-v") == 0) {
++argp;
} else if (*ap[0] != '-') {
break;
}
} else if (*ap[0] != '-') {
break;
}
char *cp, *prog, **vec;
struct stat st;
char *cp, *prog, **vec;
struct stat st;
/* Was there a previous edit session? */
if (reedit && (*ed || edsave)) {
/* Was there a previous edit session? */
if (reedit && (*ed || edsave)) {
if (symlink (altpath, linkpath) < 0) {
adios (linkpath, "symlink");
}
if (symlink (altpath, linkpath) < 0) {
adios (linkpath, "symlink");
}
FILE *f;
m_getfld_state_t gstate;
char buf[NMH_BUFSIZ], name[NAMESZ];
FILE *f;
m_getfld_state_t gstate;
char buf[NMH_BUFSIZ], name[NAMESZ];
+ int state;
+ bool retval = false;
if ((f = fopen(drft, "r")) == NULL) {
admonish(drft, "unable to read draft");
if ((f = fopen(drft, "r")) == NULL) {
admonish(drft, "unable to read draft");
if (strcasecmp(name, VRSN_FIELD) == 0) {
inform("Cannot use attach commands with already-"
"formatted MIME message \"%s\"", drft);
if (strcasecmp(name, VRSN_FIELD) == 0) {
inform("Cannot use attach commands with already-"
"formatted MIME message \"%s\"", drft);