summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6319a50)
Knowing the domain of the variable is Boolean aids comprehension of the
variable's name and purpose.
bool
ismymbox (struct mailname *np)
{
bool
ismymbox (struct mailname *np)
{
int len, i;
char *cp;
char *pp;
int len, i;
char *cp;
char *pp;
struct mailname *mp;
static char *am = NULL;
static struct mailname mq;
struct mailname *mp;
static char *am = NULL;
static struct mailname mq;
- static int localmailbox = 0;
+ static bool localmailbox;
/*
* If this is the first call, initialize
/*
* If this is the first call, initialize
if ((am = context_find ("local-mailbox"))) {
if ((am = context_find ("local-mailbox"))) {
if ((cp = getname(am)) == NULL) {
inform("Unable to find address in local-mailbox, continuing...");
if ((cp = getname(am)) == NULL) {
inform("Unable to find address in local-mailbox, continuing...");
am = getusername();
else {
mp = mq.m_next ? mq.m_next : &mq;
am = getusername();
else {
mp = mq.m_next ? mq.m_next : &mq;
while ((cp = getname (am))) {
if ((mp->m_next = getm (cp, NULL, 0, NULL, 0)) == NULL) {
inform("illegal address: %s, continuing...", cp);
while ((cp = getname (am))) {
if ((mp->m_next = getm (cp, NULL, 0, NULL, 0)) == NULL) {
inform("illegal address: %s, continuing...", cp);
} else {
mp = mp->m_next;
mp->m_type = W_NIL;
} else {
mp = mp->m_next;
mp->m_type = W_NIL;
const char *charset)
{
int prefixlen = strlen(name) + 2, column = prefixlen, groupflag;
const char *charset)
{
int prefixlen = strlen(name) + 2, column = prefixlen, groupflag;
- int asciichars, specialchars, eightbitchars, reformat = 0, errflag = 0;
+ int asciichars;
+ int specialchars;
+ int eightbitchars;
+ bool reformat = false;
+ bool errflag = false;
size_t len;
char *mp, *cp = NULL, *output = NULL;
char *tmpbuf = NULL;
size_t len;
char *mp, *cp = NULL, *output = NULL;
char *tmpbuf = NULL;
for (groupflag = 0; (mp = getname(*value)); ) {
if ((mn = getm(mp, NULL, 0, errbuf, sizeof(errbuf))) == NULL) {
inform("%s: %s", errbuf, mp);
for (groupflag = 0; (mp = getname(*value)); ) {
if ((mn = getm(mp, NULL, 0, errbuf, sizeof(errbuf))) == NULL) {
inform("%s: %s", errbuf, mp);
/*
* We only care if the phrase (m_pers) or any trailing comment
/*
* We only care if the phrase (m_pers) or any trailing comment
case CE_BASE64:
if (field_encode_base64(NULL, &mn->m_pers, charset)) {
case CE_BASE64:
if (field_encode_base64(NULL, &mn->m_pers, charset)) {
case CE_QUOTED:
if (field_encode_quoted(NULL, &mn->m_pers, charset, asciichars,
eightbitchars + specialchars, 1)) {
case CE_QUOTED:
if (field_encode_quoted(NULL, &mn->m_pers, charset, asciichars,
eightbitchars + specialchars, 1)) {
goto out;
}
break;
default:
inform("Internal error: unknown RFC-2047 encoding type");
goto out;
}
break;
default:
inform("Internal error: unknown RFC-2047 encoding type");
if (mn->m_note[0] != '(' || mn->m_note[len - 1] != ')') {
inform("Internal error: Invalid note field \"%s\"",
mn->m_note);
if (mn->m_note[0] != '(' || mn->m_note[len - 1] != ')') {
inform("Internal error: Invalid note field \"%s\"",
mn->m_note);
case CE_BASE64:
if (field_encode_base64(NULL, &tmpbuf, charset)) {
case CE_BASE64:
if (field_encode_base64(NULL, &tmpbuf, charset)) {
case CE_QUOTED:
if (field_encode_quoted(NULL, &tmpbuf, charset, asciichars,
eightbitchars + specialchars, 1)) {
case CE_QUOTED:
if (field_encode_quoted(NULL, &tmpbuf, charset, asciichars,
eightbitchars + specialchars, 1)) {
goto out;
}
break;
default:
inform("Internal error: unknown RFC-2047 encoding type");
goto out;
}
break;
default:
inform("Internal error: unknown RFC-2047 encoding type");
/*
* Make sure the size of tmpbuf is correct (it always gets
/*
* Make sure the size of tmpbuf is correct (it always gets
free(tmpbuf);
free(output);
free(tmpbuf);
free(output);
formataddr (char *orig, char *str)
{
int len;
formataddr (char *orig, char *str)
{
int len;
char *dst;
char *cp;
char *sp;
char *dst;
char *cp;
char *sp;
}
/* concatenate all the new addresses onto 'buf' */
}
/* concatenate all the new addresses onto 'buf' */
- for (isgroup = 0; (cp = getname (str)); ) {
+ for (isgroup = false; (cp = getname (str)); ) {
if ((mp = getm (cp, NULL, 0, NULL, 0)) == NULL)
continue;
if (isgroup && (mp->m_gname || !mp->m_ingrp)) {
*dst++ = ';';
if ((mp = getm (cp, NULL, 0, NULL, 0)) == NULL)
continue;
if (isgroup && (mp->m_gname || !mp->m_ingrp)) {
*dst++ = ';';
}
/* if we get here we're going to add an address */
if (dst != buf) {
}
/* if we get here we're going to add an address */
if (dst != buf) {
if (mp->m_gname) {
CHECKMEM (mp->m_gname);
CPY (mp->m_gname);
if (mp->m_gname) {
CHECKMEM (mp->m_gname);
CPY (mp->m_gname);
}
sp = adrformat (mp);
CHECKMEM (sp);
}
sp = adrformat (mp);
CHECKMEM (sp);
int wid = 0;
char fill = ' ';
c = *cp++;
if (c == '-') {
int wid = 0;
char fill = ' ';
c = *cp++;
if (c == '-') {
c = *cp++;
}
if (c == '0') {
c = *cp++;
}
if (c == '0') {
char *cp = sp;
int c;
int i;
char *cp = sp;
int c;
int i;
while (isalnum(c = *cp++) || c == '-' || c == '_')
;
while (isalnum(c = *cp++) || c == '-' || c == '_')
;
case FT_GETMYADDR:
if (!primed) {
ismymbox(NULL);
case FT_GETMYADDR:
if (!primed) {
ismymbox(NULL);
}
/* FALLTHRU */
case FT_PARSEADDR:
}
/* FALLTHRU */
case FT_PARSEADDR:
int
fmt_addcomptext(char *component, char *text)
{
int
fmt_addcomptext(char *component, char *text)
{
- int i, found = 0, bucket = CHASH(component);
+ int i;
+ bool found = false;
+ int bucket = CHASH(component);
struct comp *cptr = wantcomp[bucket];
char *cp;
while (cptr) {
if (strcasecmp(component, FENDNULL(cptr->c_name)) == 0) {
struct comp *cptr = wantcomp[bucket];
char *cp;
while (cptr) {
if (strcasecmp(component, FENDNULL(cptr->c_name)) == 0) {
if (! cptr->c_text) {
cptr->c_text = getcpy(text);
} else {
if (! cptr->c_text) {
cptr->c_text = getcpy(text);
} else {
void
cptrimmed(charstring_t dest, char *str, int wid, char fill, size_t max) {
int remaining; /* remaining output width available */
void
cptrimmed(charstring_t dest, char *str, int wid, char fill, size_t max) {
int remaining; /* remaining output width available */
struct charstring *trimmed;
size_t end; /* number of input bytes remaining in str */
#ifdef MULTIBYTE_SUPPORT
struct charstring *trimmed;
size_t end; /* number of input bytes remaining in str */
#ifdef MULTIBYTE_SUPPORT
char *sp; /* current position in source string */
/* get alignment */
char *sp; /* current position in source string */
/* get alignment */
if ((remaining = wid) < 0) {
remaining = -remaining;
if ((remaining = wid) < 0) {
remaining = -remaining;
}
if (remaining > (int) max) { remaining = max; }
}
if (remaining > (int) max) { remaining = max; }
char *sp;
char *savestr, *str;
char buffer[NMH_BUFSIZ], buffer2[NMH_BUFSIZ];
char *sp;
char *savestr, *str;
char buffer[NMH_BUFSIZ], buffer2[NMH_BUFSIZ];
+ int i, c;
+ bool rjust;
int value;
time_t t;
size_t max;
int value;
time_t t;
size_t max;
break;
case FT_LITF:
sp = fmt->f_text;
break;
case FT_LITF:
sp = fmt->f_text;
i = fmt->f_width;
if (i < 0) {
i = -i;
i = fmt->f_width;
if (i < 0) {
i = -i;
- rjust++; /* XXX should do something with this */
+ rjust = true; /* XXX should do something with this */
}
while ((c = *sp++) && --i >= 0 && charstring_chars (scanlp) < max) {
charstring_push_back (scanlp, c);
}
while ((c = *sp++) && --i >= 0 && charstring_chars (scanlp) < max) {
charstring_push_back (scanlp, c);
str = buffer;
while (isspace((unsigned char) *str))
str++;
str = buffer;
while (isspace((unsigned char) *str))
str++;
if ((i = fmt->f_width) < 0) {
i = -i;
if ((i = fmt->f_width) < 0) {
i = -i;
}
if (!rjust && i > 0 && (int) strlen(str) > i)
}
if (!rjust && i > 0 && (int) strlen(str) > i)
static int netsec_get_password(sasl_conn_t *conn, void *context, int id,
sasl_secret_t **psecret);
static int netsec_get_password(sasl_conn_t *conn, void *context, int id,
sasl_secret_t **psecret);
-static int sasl_initialized = 0;
+static bool sasl_initialized;
#define SASL_MAXRECVBUF 65536
#endif /* CYRUS_SASL */
#define SASL_MAXRECVBUF 65536
#endif /* CYRUS_SASL */
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
-static int tls_initialized = 0;
+static bool tls_initialized;
static SSL_CTX *sslctx = NULL; /* SSL Context */
#endif /* TLS_SUPPORT */
static SSL_CTX *sslctx = NULL; /* SSL Context */
#endif /* TLS_SUPPORT */
sasl_errstring(retval, NULL, NULL));
return NOTOK;
}
sasl_errstring(retval, NULL, NULL));
return NOTOK;
}
+ sasl_initialized = true;
+ tls_initialized = true;
}
if (nsc->ns_readfd == -1 || nsc->ns_writefd == -1) {
}
if (nsc->ns_readfd == -1 || nsc->ns_writefd == -1) {
void
print_sw (const char *substr, const struct swit *swp, char *prefix, FILE *fp)
{
void
print_sw (const char *substr, const struct swit *swp, char *prefix, FILE *fp)
{
int i;
char *cp, *cp1, *sp;
char buf[128];
int i;
char *cp, *cp1, *sp;
char buf[128];
for (; swp->sw; swp++) {
/* null matches all strings */
if (!*substr || (ssequal (substr, swp->sw) && len >= swp->minchars)) {
for (; swp->sw; swp++) {
/* null matches all strings */
if (!*substr || (ssequal (substr, swp->sw) && len >= swp->minchars)) {
/* next switch */
if ((sp = (&swp[1])->sw)) {
if (!*substr && sp[0] == 'n' && sp[1] == 'o' &&
strcmp (&sp[2], swp->sw) == 0 && (
((&swp[1])->minchars == 0 && swp->minchars == 0) ||
((&swp[1])->minchars == (swp->minchars) + 2)))
/* next switch */
if ((sp = (&swp[1])->sw)) {
if (!*substr && sp[0] == 'n' && sp[1] == 'o' &&
strcmp (&sp[2], swp->sw) == 0 && (
((&swp[1])->minchars == 0 && swp->minchars == 0) ||
((&swp[1])->minchars == (swp->minchars) + 2)))
}
if (swp->minchars > 0) {
}
if (swp->minchars > 0) {
*/
static int find_delim (int, struct smsg *, int *);
static void find_mime_parts (CT, struct smsg *, int *);
*/
static int find_delim (int, struct smsg *, int *);
static void find_mime_parts (CT, struct smsg *, int *);
-static void burst (struct msgs **, int, struct smsg *, int, int, int,
+static void burst(struct msgs **, int, struct smsg *, int, bool, bool,
char *, int);
static void cpybrst (FILE *, FILE *, char *, char *, int, int);
char *, int);
static void cpybrst (FILE *, FILE *, char *, char *, int, int);
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
- int inplace = 0, quietsw = 0, verbosw = 0, mimesw = 1;
+ bool inplace = false;
+ bool quietsw = false;
+ bool verbosw = false;
+ int mimesw = 1;
int hi, msgnum, numburst;
char *cp, *maildir, *folder = NULL, buf[BUFSIZ];
char **argp, **arguments;
int hi, msgnum, numburst;
char *cp, *maildir, *folder = NULL, buf[BUFSIZ];
char **argp, **arguments;
static void
burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
static void
burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
- int inplace, int verbosw, char *maildir, int mimesw)
+ bool inplace, bool verbosw, char *maildir, int mimesw)
{
int i, j, mode;
char *msgnam;
{
int i, j, mode;
char *msgnam;
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
- int use = NOUSE, nedit = 0, nwhat = 0, build = 0;
+ int use = NOUSE;
+ bool nedit = false;
+ bool nwhat = false;
+ bool build = false;
int i, in = NOTOK, isdf = 0, out, dat[5], format_len = 0;
int outputlinelen = OUTPUTLINELEN;
char *cp, *cwd, *maildir, *dfolder = NULL;
int i, in = NOTOK, isdf = 0, out, dat[5], format_len = 0;
int outputlinelen = OUTPUTLINELEN;
char *cp, *cwd, *maildir, *dfolder = NULL;
case EDITRSW:
if (!(ed = *argp++) || *ed == '-')
die("missing argument to %s", argp[-2]);
case EDITRSW:
if (!(ed = *argp++) || *ed == '-')
die("missing argument to %s", argp[-2]);
continue;
case WHATSW:
if (!(whatnowproc = *argp++) || *whatnowproc == '-')
die("missing argument to %s", argp[-2]);
continue;
case WHATSW:
if (!(whatnowproc = *argp++) || *whatnowproc == '-')
die("missing argument to %s", argp[-2]);
/* FALLTHRU */
case NWHATSW:
/* FALLTHRU */
case NWHATSW:
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
- int anot = 0, inplace = 1, nedit = 0;
- int nwhat = 0, i, in, isdf = 0, out;
+ bool anot = false;
+ bool inplace = true;
+ bool nedit = false;
+ bool nwhat = false;
+ int i, in, isdf = 0, out;
int outputlinelen = OUTPUTLINELEN;
int outputlinelen = OUTPUTLINELEN;
- int dat[5], atfile = 0;
+ int dat[5];
+ bool atfile = false;
char *cp, *cwd, *maildir, *msgnam, *dfolder = NULL;
char *dmsg = NULL, *ed = NULL, *file = NULL, *folder = NULL;
char *form = NULL, *msg = NULL, buf[BUFSIZ], drft[BUFSIZ];
char *cp, *cwd, *maildir, *msgnam, *dfolder = NULL;
char *dmsg = NULL, *ed = NULL, *file = NULL, *folder = NULL;
char *form = NULL, *msg = NULL, buf[BUFSIZ], drft[BUFSIZ];
continue;
case EDITRSW:
if (!(ed = *argp++) || *ed == '-')
die("missing argument to %s", argp[-2]);
continue;
case EDITRSW:
if (!(ed = *argp++) || *ed == '-')
die("missing argument to %s", argp[-2]);
continue;
case WHATSW:
if (!(whatnowproc = *argp++) || *whatnowproc == '-')
die("missing argument to %s", argp[-2]);
continue;
case WHATSW:
if (!(whatnowproc = *argp++) || *whatnowproc == '-')
die("missing argument to %s", argp[-2]);
continue;
case NOATFILESW:
continue;
case NOATFILESW:
- anot = 0; /* don't want to annotate a file */
+ anot = false; /* don't want to annotate a file */
} else {
/*
* Dist a message
} else {
/*
* Dist a message
static void mlistfree(void);
static bool nodupcheck; /* If set, no check for duplicates */
static void mlistfree(void);
static bool nodupcheck; /* If set, no check for duplicates */
-static int ccme = 0; /* Should I cc myself? */
+static bool ccme; /* Should I cc myself? */
static struct mailname mq; /* Mail addresses to check for duplicates */
static char *dummy = "dummy";
static struct mailname mq; /* Mail addresses to check for duplicates */
static char *dummy = "dummy";
struct format *fmt;
struct comp *cptr;
struct msgs_array msgs = { 0, 0, NULL }, compargs = { 0, 0, NULL};
struct format *fmt;
struct comp *cptr;
struct msgs_array msgs = { 0, 0, NULL }, compargs = { 0, 0, NULL};
- int dump = 0, i;
- int outputsize = 0, dupaddrs = 1, trace = 0, files = 0;
+ bool dump = false;
+ int i;
+ int outputsize = 0;
+ bool dupaddrs = true;
+ bool trace = false;
+ int files = 0;
int colwidth = -1, msgnum = -1, msgcur = -1, msgsize = -1, msgunseen = -1;
enum mode_t mode = MESSAGE;
int dat[5];
int colwidth = -1, msgnum = -1, msgcur = -1, msgsize = -1, msgunseen = -1;
enum mode_t mode = MESSAGE;
int dat[5];
case MESSAGESW:
mode = MESSAGE;
defformat = FORMAT;
case MESSAGESW:
mode = MESSAGE;
defformat = FORMAT;
continue;
case DATESW:
mode = DATE;
continue;
case DATESW:
mode = DATE;
continue;
case DUPADDRSW:
continue;
case DUPADDRSW:
continue;
case NDUPADDRSW:
continue;
case NDUPADDRSW:
* callback, do that now. Also, prime ismymbox if we use it.
*/
* callback, do that now. Also, prime ismymbox if we use it.
*/
- if (dupaddrs == 0 || trace) {
+ if (!dupaddrs || trace) {
cb.formataddr = test_formataddr;
cb.concataddr = test_concataddr;
if (!ccme)
cb.formataddr = test_formataddr;
cb.concataddr = test_concataddr;
if (!ccme)
const char *outbuf)
{
struct trace_context *ctx = (struct trace_context *) context;
const char *outbuf)
{
struct trace_context *ctx = (struct trace_context *) context;
dumpone(fmt);
if (num != ctx->num) {
printf("num=%d", num);
ctx->num = num;
dumpone(fmt);
if (num != ctx->num) {
printf("num=%d", num);
ctx->num = num;
fputs("str=", stdout);
litputs(str);
ctx->str = str;
fputs("str=", stdout);
litputs(str);
ctx->str = str;
{
int len;
char error[BUFSIZ];
{
int len;
char error[BUFSIZ];
char *dst;
char *cp;
char *sp;
char *dst;
char *cp;
char *sp;
}
/* concatenate all the new addresses onto 'buf' */
}
/* concatenate all the new addresses onto 'buf' */
- for (isgroup = 0; (cp = getname (str)); ) {
+ for (isgroup = false; (cp = getname (str)); ) {
if ((mp = getm (cp, NULL, 0, error, sizeof(error))) == NULL) {
fprintf(stderr, "bad address \"%s\" -- %s\n", cp, error);
continue;
}
if (isgroup && (mp->m_gname || !mp->m_ingrp)) {
*dst++ = ';';
if ((mp = getm (cp, NULL, 0, error, sizeof(error))) == NULL) {
fprintf(stderr, "bad address \"%s\" -- %s\n", cp, error);
continue;
}
if (isgroup && (mp->m_gname || !mp->m_ingrp)) {
*dst++ = ';';
}
if (insert (mp)) {
/* if we get here we're going to add an address */
}
if (insert (mp)) {
/* if we get here we're going to add an address */
if (mp->m_gname) {
CHECKMEM (mp->m_gname);
CPY (mp->m_gname);
if (mp->m_gname) {
CHECKMEM (mp->m_gname);
CPY (mp->m_gname);
}
sp = adrformat (mp);
CHECKMEM (sp);
}
sp = adrformat (mp);
CHECKMEM (sp);