-
-/*
- * fmttest.c -- A program to help test and debug format instructions
+/* fmttest.c -- A program to help test and debug format instructions
*
* This code is Copyright (c) 2012, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
-#include <h/mh.h>
-#include <h/fmt_scan.h>
-#include <h/fmt_compile.h>
-#include <h/utils.h>
-#include <h/scansbr.h>
-#include <h/addrsbr.h>
+#include "h/mh.h"
+#include "sbr/fmt_new.h"
+#include "scansbr.h"
+#include "sbr/m_name.h"
+#include "sbr/m_getfld.h"
+#include "sbr/getarguments.h"
+#include "sbr/seq_setprev.h"
+#include "sbr/seq_save.h"
+#include "sbr/smatch.h"
+#include "sbr/snprintb.h"
+#include "sbr/getcpy.h"
+#include "sbr/m_convert.h"
+#include "sbr/getfolder.h"
+#include "sbr/folder_read.h"
+#include "sbr/folder_free.h"
+#include "sbr/context_save.h"
+#include "sbr/context_replace.h"
+#include "sbr/context_find.h"
+#include "sbr/brkstring.h"
+#include "sbr/ambigsw.h"
+#include "sbr/path.h"
+#include "sbr/print_version.h"
+#include "sbr/print_help.h"
+#include "sbr/seq_getnum.h"
+#include "sbr/error.h"
+#include "h/fmt_scan.h"
+#include "h/fmt_compile.h"
+#include "h/utils.h"
+#include "h/addrsbr.h"
+#include "h/done.h"
+#include "sbr/m_maildir.h"
+#include "sbr/terminal.h"
#define FMTTEST_SWITCHES \
X("form formatfile", 0, FORMSW) \
static int insert(struct mailname *);
static void mlistfree(void);
-static int nodupcheck = 0; /* If set, no check for duplicates */
-static int ccme = 0; /* Should I cc myself? */
+static bool nodupcheck; /* If set, no check for duplicates */
+static bool ccme; /* Should I cc myself? */
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};
- int dump = 0, i;
- int outputsize = 0, dupaddrs = 1, trace = 0, files = 0;
+ bool dump = false;
+ int i;
+ 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];
struct fmt_callbacks cb, *cbp = NULL;
- if (nmh_init(argv[0], 1)) { return 1; }
+ if (nmh_init(argv[0], true, true)) { return 1; }
arguments = getarguments (invo_name, argc, argv, 1);
argp = arguments;
+ bool outputsize_given = false;
+ int outputsize;
while ((cp = *argp++)) {
if (*cp == '-') {
/*
*/
if (*++cp == '-') {
if (*++cp == '\0')
- adios(NULL, "missing component name after --");
+ die("missing component name after --");
app_msgarg(&compargs, cp);
/* Grab next argument for component text */
if (!(cp = *argp++))
- adios(NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
app_msgarg(&compargs, cp);
continue;
}
ambigsw (cp, switches);
done (1);
case UNKWNSW:
- adios (NULL, "-%s unknown", cp);
+ die("-%s unknown", cp);
case HELPSW:
snprintf (buf, sizeof(buf), "%s [switches]", invo_name);
print_version(invo_name);
done (0);
case OTHERSW:
- adios(NULL, "internal argument error!");
+ die("internal argument error!");
continue;
case OUTSIZESW:
+ outputsize_given = true;
if (!(cp = *argp++) || *cp == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
if (strcmp(cp, "max") == 0)
outputsize = INT_MAX;
else if (strcmp(cp, "width") == 0)
case FORMSW:
if (!(form = *argp++) || *form == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
format = NULL;
continue;
case FMTSW:
if (!(format = *argp++) || *format == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
form = NULL;
continue;
case TRACESW:
- trace++;
+ trace = true;
continue;
case NTRACESW:
- trace = 0;
+ trace = false;
continue;
case ADDRSW:
case MESSAGESW:
mode = MESSAGE;
defformat = FORMAT;
- dupaddrs = 0;
+ dupaddrs = false;
continue;
case DATESW:
mode = DATE;
continue;
case DUPADDRSW:
- dupaddrs++;
+ dupaddrs = true;
continue;
case NDUPADDRSW:
- dupaddrs = 0;
+ dupaddrs = false;
continue;
case CCMESW:
- ccme++;
+ ccme = true;
continue;
case NCCMESW:
- ccme = 0;
+ ccme = false;
continue;
case WIDTHSW:
if (!(cp = *argp++) || *cp == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
colwidth = atoi(cp);
continue;
case MSGNUMSW:
if (!(cp = *argp++) || *cp == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
msgnum = atoi(cp);
continue;
case MSGCURSW:
if (!(cp = *argp++) || *cp == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
msgcur = atoi(cp);
continue;
case MSGSIZESW:
if (!(cp = *argp++) || *cp == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
msgsize = atoi(cp);
continue;
case UNSEENSW:
if (!(cp = *argp++) || *cp == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
msgunseen = atoi(cp);
continue;
case DUMPSW:
- dump++;
+ dump = true;
continue;
case NDUMPSW:
- dump = 0;
+ dump = false;
continue;
}
if (mode == MESSAGE && !files && (*cp == '+' || *cp == '@')) {
if (folder)
- adios (NULL, "only one folder at a time!");
- else
- folder = pluspath (cp);
+ die("only one folder at a time!");
+ folder = pluspath (cp);
} else
app_msgarg(&msgs, cp);
}
*/
if (!dump && compargs.size == 0 && msgs.size == 0) {
- adios (NULL, "usage: [switches] [+folder] msgs | strings...",
- invo_name);
+ die("usage: [switches] [+folder] msgs | strings...");
}
/*
*/
if (mode == RAW && form == NULL && format == NULL) {
- adios (NULL, "You must specify a format with -form or -format when "
+ die("You must specify a format with -form or -format when "
"using -raw");
}
buffer = charstring_create(BUFSIZ);
- if (outputsize == 0) {
- if (mode == MESSAGE)
- outputsize = sc_width();
- else
- outputsize = INT_MAX;
+ if (!outputsize_given) {
+ outputsize = mode == MESSAGE ? sc_width() : INT_MAX;
}
dat[0] = msgnum;
* callback, do that now. Also, prime ismymbox if we use it.
*/
- if (dupaddrs == 0 || trace) {
- memset(&cb, 0, sizeof(cb));
+ if (!dupaddrs || trace) {
+ ZERO(&cb);
cbp = &cb;
- if (dupaddrs == 0) {
+ if (!dupaddrs) {
cb.formataddr = test_formataddr;
cb.concataddr = test_concataddr;
if (!ccme)
for (p = pq.pq_next; p; p = q) {
c = fmt_findcomp("text");
if (c) {
- mh_xfree(c->c_text);
+ free(c->c_text);
c->c_text = p->pq_text;
p->pq_text = NULL;
}
c = fmt_findcomp("error");
if (c) {
- mh_xfree(c->c_text);
+ free(c->c_text);
c->c_text = p->pq_error;
p->pq_error = NULL;
}
fmt_scan(fmt, buffer, outwidth, dat, cb);
fputs(charstring_buffer(buffer), stdout);
+ charstring_clear(buffer);
mlistfree();
- mh_xfree(p->pq_text);
- mh_xfree(p->pq_error);
+ free(p->pq_text);
+ free(p->pq_error);
q = p->pq_next;
free(p);
}
adios(maildir, "unable to change directory to");
if (!(mp = folder_read(folder, 1)))
- adios(NULL, "unable to read folder %s", folder);
+ die("unable to read folder %s", folder);
if (mp->nummsg == 0)
- adios(NULL, "no messages in %s", folder);
+ die("no messages in %s", folder);
for (i = 0; i < msgs->size; i++)
if (!m_convert(mp, msgs->msgs[i]))
done(1);
seq_setprev(mp); /* set the Previous-Sequence */
- context_replace(pfolder, folder); /* update curren folder */
+ context_replace(pfolder, folder); /* update current folder */
seq_save(mp); /* synchronize message sequences */
context_save(); /* save the context file */
ivector_push_back (seqnum, seq_getnum(mp, *ap));
num_unseen_seq = i;
- mh_xfree(dp);
+ free(dp);
}
}
ivector_free (seqnum);
folder_free(mp);
- return;
}
/*
{
int i, state;
char name[NAMESZ], rbuf[NMH_BUFSIZ];
- m_getfld_state_t gstate = 0;
+ m_getfld_state_t gstate;
struct comp *c;
int bufsz;
}
/*
- * Initialize everyting else
+ * Initialize everything else
*/
if (dat[0] == -1)
* Read in the message and process the components
*/
+ gstate = m_getfld_state_init(in);
for (;;) {
bufsz = sizeof(rbuf);
- state = m_getfld(&gstate, name, rbuf, &bufsz, in);
+ state = m_getfld2(&gstate, name, rbuf, &bufsz);
switch (state) {
case FLD:
case FLDPLUS:
if (i != -1) {
while (state == FLDPLUS) {
bufsz = sizeof(rbuf);
- state = m_getfld(&gstate, name, rbuf, &bufsz, in);
+ state = m_getfld2(&gstate, name, rbuf, &bufsz);
fmt_appendcomp(i, name, rbuf);
}
}
while (state == FLDPLUS) {
bufsz = sizeof(rbuf);
- state = m_getfld(&gstate, name, rbuf, &bufsz, in);
+ state = m_getfld2(&gstate, name, rbuf, &bufsz);
}
break;
if (fmt_findcomp("body")) {
if ((i = strlen(rbuf)) < outwidth) {
bufsz = min (outwidth, (int) sizeof rbuf - i);
- m_getfld(&gstate, name, rbuf + i, &bufsz, in);
+ m_getfld2(&gstate, name, rbuf + i, &bufsz);
}
fmt_addcomptext("body", rbuf);
}
- /* fall through */
+ goto finished;
default:
goto finished;
for (i = 0; i < comps->size; i += 2) {
c = fmt_findcomp(comps->msgs[i]);
if (c) {
- mh_xfree(c->c_text);
+ free(c->c_text);
c->c_text = getcpy(comps->msgs[i + 1]);
}
}
}
fmt_scan(fmt, buffer, outwidth, dat, cb);
fputs(charstring_buffer (buffer), stdout);
+ charstring_clear(buffer);
mlistfree();
}
for (i = 0; i < text->size; i++) {
if (c != NULL) {
- mh_xfree(c->c_text);
+ free(c->c_text);
c->c_text = getcpy(text->msgs[i]);
}
fmt_scan(fmt, buffer, outwidth, dat, cb);
fputs(charstring_buffer (buffer), stdout);
+ charstring_clear(buffer);
mlistfree();
}
}
const char *outbuf)
{
struct trace_context *ctx = (struct trace_context *) context;
- int changed = 0;
+ bool changed = false;
dumpone(fmt);
if (num != ctx->num) {
printf("num=%d", num);
ctx->num = num;
- changed++;
+ changed = true;
}
if (str != ctx->str) {
- if (changed++)
+ if (changed)
putchar(' ');
- printf("str=");
+ changed = true;
+ fputs("str=", stdout);
litputs(str);
ctx->str = str;
}
putchar('\n');
if (strcmp(outbuf, ctx->outbuf) != 0) {
- printf("outbuf=");
+ fputs("outbuf=", stdout);
litputs(outbuf);
putchar('\n');
free(ctx->outbuf);
case FT_LS_COMP:
case FT_LV_COMPFLAG:
case FT_LV_COMP:
- printf(", comp ");
+ fputs(", comp ", stdout);
litputs(fmt->f_comp->c_name);
if (fmt->f_comp->c_type)
printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
case FT_LOCALDATE:
case FT_GMTDATE:
case FT_PARSEDATE:
- printf(", c_name ");
+ fputs(", c_name ", stdout);
litputs(fmt->f_comp->c_name);
if (fmt->f_comp->c_type)
printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
case FT_MYMBOX:
case FT_GETMYMBOX:
case FT_GETMYADDR:
- printf(", c_name ");
+ fputs(", c_name ", stdout);
litputs(fmt->f_comp->c_name);
if (fmt->f_comp->c_type)
printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
case FT_COMPF:
printf(", width %d, fill '", fmt->f_width);
litputc(fmt->f_fill);
- printf("' name ");
+ fputs("' name ", stdout);
litputs(fmt->f_comp->c_name);
if (fmt->f_comp->c_type)
printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
break;
case FT_LIT:
-#ifdef FT_LIT_FORCE
- case FT_LIT_FORCE:
-#endif
putchar(' ');
litputs(fmt->f_text);
break;
case FT_LITF:
printf(", width %d, fill '", fmt->f_width);
litputc(fmt->f_fill);
- printf("' ");
+ fputs("' ", stdout);
litputs(fmt->f_text);
break;
case FT_IF_S_NULL:
case FT_IF_MATCH:
case FT_IF_AMATCH:
- printf(" continue else goto");
+ fputs(" continue else goto", stdout);
+ /* FALLTHRU */
case FT_GOTO:
i = findlabel(fmt + fmt->f_skip);
printf(" L%d", i);
break;
case FT_LS_LIT:
- printf(" str ");
+ fputs(" str ", stdout);
litputs(fmt->f_text);
break;
case FT_LS_GETENV:
- printf(" getenv ");
+ fputs(" getenv ", stdout);
litputs(fmt->f_text);
break;
case FT_LS_DECODECOMP:
- printf(", comp ");
+ fputs(", comp ", stdout);
litputs(fmt->f_comp->c_name);
break;
for (i = 0; i < lused; ++i)
if (addr == lvec[i])
- return(i);
- return(-1);
+ return i;
+ return -1;
}
static void
static char buf[32];
switch (t) {
- case FT_COMP: return("COMP");
- case FT_COMPF: return("COMPF");
- case FT_LIT: return("LIT");
- case FT_LITF: return("LITF");
-#ifdef FT_LIT_FORCE
- case FT_LIT_FORCE: return("LIT_FORCE");
-#endif
- case FT_CHAR: return("CHAR");
- case FT_NUM: return("NUM");
- case FT_NUMF: return("NUMF");
- case FT_STR: return("STR");
- case FT_STRF: return("STRF");
- case FT_STRFW: return("STRFW");
- case FT_PUTADDR: return("PUTADDR");
- case FT_STRLIT: return("STRLIT");
- case FT_STRLITZ: return("STRLITZ");
- case FT_LS_COMP: return("LS_COMP");
- case FT_LS_LIT: return("LS_LIT");
- case FT_LS_GETENV: return("LS_GETENV");
- case FT_LS_DECODECOMP: return("LS_DECODECOMP");
- case FT_LS_DECODE: return("LS_DECODE");
- case FT_LS_TRIM: return("LS_TRIM");
- case FT_LV_COMP: return("LV_COMP");
- case FT_LV_COMPFLAG: return("LV_COMPFLAG");
- case FT_LV_LIT: return("LV_LIT");
- case FT_LV_DAT: return("LV_DAT");
- case FT_LV_STRLEN: return("LV_STRLEN");
- case FT_LV_PLUS_L: return("LV_PLUS_L");
- case FT_LV_MINUS_L: return("LV_MINUS_L");
- case FT_LV_MULTIPLY_L: return("LV_MULTIPLY_L");
- case FT_LV_DIVIDE_L: return("LV_DIVIDE_L");
- case FT_LV_MODULO_L: return("LV_MODULO_L");
- case FT_LV_CHAR_LEFT: return("LV_CHAR_LEFT");
- case FT_LS_MONTH: return("LS_MONTH");
- case FT_LS_LMONTH: return("LS_LMONTH");
- case FT_LS_ZONE: return("LS_ZONE");
- case FT_LS_DAY: return("LS_DAY");
- case FT_LS_WEEKDAY: return("LS_WEEKDAY");
- case FT_LS_822DATE: return("LS_822DATE");
- case FT_LS_PRETTY: return("LS_PRETTY");
- case FT_LV_SEC: return("LV_SEC");
- case FT_LV_MIN: return("LV_MIN");
- case FT_LV_HOUR: return("LV_HOUR");
- case FT_LV_MDAY: return("LV_MDAY");
- case FT_LV_MON: return("LV_MON");
- case FT_LV_YEAR: return("LV_YEAR");
- case FT_LV_YDAY: return("LV_YDAY");
- case FT_LV_WDAY: return("LV_WDAY");
- case FT_LV_ZONE: return("LV_ZONE");
- case FT_LV_CLOCK: return("LV_CLOCK");
- case FT_LV_RCLOCK: return("LV_RCLOCK");
- case FT_LV_DAYF: return("LV_DAYF");
- case FT_LV_DST: return("LV_DST");
- case FT_LV_ZONEF: return("LV_ZONEF");
- case FT_LS_ADDR: return("LS_ADDR");
- case FT_LS_PERS: return("LS_PERS");
- case FT_LS_MBOX: return("LS_MBOX");
- case FT_LS_HOST: return("LS_HOST");
- case FT_LS_PATH: return("LS_PATH");
- case FT_LS_GNAME: return("LS_GNAME");
- case FT_LS_NOTE: return("LS_NOTE");
- case FT_LS_822ADDR: return("LS_822ADDR");
- case FT_LS_FRIENDLY: return("LS_FRIENDLY");
- case FT_LV_HOSTTYPE: return("LV_HOSTTYPE");
- case FT_LV_INGRPF: return("LV_INGRPF");
- case FT_LS_UNQUOTE: return("LS_UNQUOTE");
- case FT_LV_NOHOSTF: return("LV_NOHOSTF");
- case FT_LOCALDATE: return("LOCALDATE");
- case FT_GMTDATE: return("GMTDATE");
- case FT_PARSEDATE: return("PARSEDATE");
- case FT_PARSEADDR: return("PARSEADDR");
- case FT_FORMATADDR: return("FORMATADDR");
- case FT_CONCATADDR: return("CONCATADDR");
- case FT_MYMBOX: return("MYMBOX");
- case FT_GETMYMBOX: return("GETMYMBOX");
- case FT_GETMYADDR: return("GETMYADDR");
-#ifdef FT_ADDTOSEQ
- case FT_ADDTOSEQ: return("ADDTOSEQ");
-#endif
- case FT_SAVESTR: return("SAVESTR");
-#ifdef FT_PAUSE
- case FT_PAUSE: return ("PAUSE");
-#endif
- case FT_DONE: return("DONE");
- case FT_NOP: return("NOP");
- case FT_GOTO: return("GOTO");
- case FT_IF_S_NULL: return("IF_S_NULL");
- case FT_IF_S: return("IF_S");
- case FT_IF_V_EQ: return("IF_V_EQ");
- case FT_IF_V_NE: return("IF_V_NE");
- case FT_IF_V_GT: return("IF_V_GT");
- case FT_IF_MATCH: return("IF_MATCH");
- case FT_IF_AMATCH: return("IF_AMATCH");
- case FT_S_NULL: return("S_NULL");
- case FT_S_NONNULL: return("S_NONNULL");
- case FT_V_EQ: return("V_EQ");
- case FT_V_NE: return("V_NE");
- case FT_V_GT: return("V_GT");
- case FT_V_MATCH: return("V_MATCH");
- case FT_V_AMATCH: return("V_AMATCH");
+ case FT_COMP: return "COMP";
+ case FT_COMPF: return "COMPF";
+ case FT_LIT: return "LIT";
+ case FT_LITF: return "LITF";
+ case FT_CHAR: return "CHAR";
+ case FT_NUM: return "NUM";
+ case FT_NUMF: return "NUMF";
+ case FT_STR: return "STR";
+ case FT_STRF: return "STRF";
+ case FT_STRFW: return "STRFW";
+ case FT_STRLIT: return "STRLIT";
+ case FT_STRLITZ: return "STRLITZ";
+ case FT_PUTADDR: return "PUTADDR";
+ case FT_LS_COMP: return "LS_COMP";
+ case FT_LS_LIT: return "LS_LIT";
+ case FT_LS_GETENV: return "LS_GETENV";
+ case FT_LS_CFIND: return "LS_CFIND";
+ case FT_LS_DECODECOMP: return "LS_DECODECOMP";
+ case FT_LS_DECODE: return "LS_DECODE";
+ case FT_LS_TRIM: return "LS_TRIM";
+ case FT_LV_COMP: return "LV_COMP";
+ case FT_LV_COMPFLAG: return "LV_COMPFLAG";
+ case FT_LV_LIT: return "LV_LIT";
+ case FT_LV_DAT: return "LV_DAT";
+ case FT_LV_STRLEN: return "LV_STRLEN";
+ case FT_LV_PLUS_L: return "LV_PLUS_L";
+ case FT_LV_MINUS_L: return "LV_MINUS_L";
+ case FT_LV_MULTIPLY_L: return "LV_MULTIPLY_L";
+ case FT_LV_DIVIDE_L: return "LV_DIVIDE_L";
+ case FT_LV_MODULO_L: return "LV_MODULO_L";
+ case FT_LV_CHAR_LEFT: return "LV_CHAR_LEFT";
+ case FT_LS_MONTH: return "LS_MONTH";
+ case FT_LS_LMONTH: return "LS_LMONTH";
+ case FT_LS_ZONE: return "LS_ZONE";
+ case FT_LS_DAY: return "LS_DAY";
+ case FT_LS_WEEKDAY: return "LS_WEEKDAY";
+ case FT_LS_822DATE: return "LS_822DATE";
+ case FT_LS_PRETTY: return "LS_PRETTY";
+ case FT_LS_KILO: return "LS_KILO";
+ case FT_LS_KIBI: return "LS_KIBI";
+ case FT_LV_SEC: return "LV_SEC";
+ case FT_LV_MIN: return "LV_MIN";
+ case FT_LV_HOUR: return "LV_HOUR";
+ case FT_LV_MDAY: return "LV_MDAY";
+ case FT_LV_MON: return "LV_MON";
+ case FT_LV_YEAR: return "LV_YEAR";
+ case FT_LV_YDAY: return "LV_YDAY";
+ case FT_LV_WDAY: return "LV_WDAY";
+ case FT_LV_ZONE: return "LV_ZONE";
+ case FT_LV_CLOCK: return "LV_CLOCK";
+ case FT_LV_RCLOCK: return "LV_RCLOCK";
+ case FT_LV_DAYF: return "LV_DAYF";
+ case FT_LV_DST: return "LV_DST";
+ case FT_LV_ZONEF: return "LV_ZONEF";
+ case FT_LS_PERS: return "LS_PERS";
+ case FT_LS_MBOX: return "LS_MBOX";
+ case FT_LS_HOST: return "LS_HOST";
+ case FT_LS_PATH: return "LS_PATH";
+ case FT_LS_GNAME: return "LS_GNAME";
+ case FT_LS_NOTE: return "LS_NOTE";
+ case FT_LS_ADDR: return "LS_ADDR";
+ case FT_LS_822ADDR: return "LS_822ADDR";
+ case FT_LS_FRIENDLY: return "LS_FRIENDLY";
+ case FT_LV_HOSTTYPE: return "LV_HOSTTYPE";
+ case FT_LV_INGRPF: return "LV_INGRPF";
+ case FT_LS_UNQUOTE: return "LS_UNQUOTE";
+ case FT_LV_NOHOSTF: return "LV_NOHOSTF";
+ case FT_LOCALDATE: return "LOCALDATE";
+ case FT_GMTDATE: return "GMTDATE";
+ case FT_PARSEDATE: return "PARSEDATE";
+ case FT_PARSEADDR: return "PARSEADDR";
+ case FT_FORMATADDR: return "FORMATADDR";
+ case FT_CONCATADDR: return "CONCATADDR";
+ case FT_MYMBOX: return "MYMBOX";
+ case FT_GETMYMBOX: return "GETMYMBOX";
+ case FT_GETMYADDR: return "GETMYADDR";
+ case FT_SAVESTR: return "SAVESTR";
+ case FT_DONE: return "DONE";
+ case FT_PAUSE: return "PAUSE";
+ case FT_NOP: return "NOP";
+ case FT_GOTO: return "GOTO";
+ case FT_IF_S_NULL: return "IF_S_NULL";
+ case FT_IF_S: return "IF_S";
+ case FT_IF_V_EQ: return "IF_V_EQ";
+ case FT_IF_V_NE: return "IF_V_NE";
+ case FT_IF_V_GT: return "IF_V_GT";
+ case FT_IF_MATCH: return "IF_MATCH";
+ case FT_IF_AMATCH: return "IF_AMATCH";
+ case FT_S_NULL: return "S_NULL";
+ case FT_S_NONNULL: return "S_NONNULL";
+ case FT_V_EQ: return "V_EQ";
+ case FT_V_NE: return "V_NE";
+ case FT_V_GT: return "V_GT";
+ case FT_V_MATCH: return "V_MATCH";
+ case FT_V_AMATCH: return "V_AMATCH";
default:
snprintf(buf, sizeof(buf), "/* ??? #%d */", t);
- return(buf);
+ return buf;
}
}
static char buf[64];
snprintb(buf, sizeof(buf), t, CT_BITS);
- return(buf);
+ return buf;
}
static char *
static char buf[64];
snprintb(buf, sizeof(buf), t, CF_BITS);
- return(buf);
+ return buf;
}
static void
{
int len;
char error[BUFSIZ];
- int isgroup;
+ bool isgroup;
char *dst;
char *cp;
char *sp;
}
/* 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++ = ';';
- isgroup = 0;
+ isgroup = false;
}
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);
- isgroup++;
+ isgroup = true;
}
sp = adrformat (mp);
CHECKMEM (sp);
*dst = '\0';
last_dst = dst;
- return (buf);
+ return buf;
}
{
char *cp;
- nodupcheck = 1;
+ nodupcheck = true;
cp = test_formataddr(orig, str);
- nodupcheck = 0;
+ nodupcheck = false;
return cp;
}
return 0;
for (mp = &mq; mp->m_next; mp = mp->m_next) {
- if (!strcasecmp (np->m_host ? np->m_host : "",
- mp->m_next->m_host ? mp->m_next->m_host : "") &&
- !strcasecmp (np->m_mbox ? np->m_mbox : "",
- mp->m_next->m_mbox ? mp->m_next->m_mbox : ""))
+ if (!strcasecmp (FENDNULL(np->m_host),
+ FENDNULL(mp->m_next->m_host)) &&
+ !strcasecmp (FENDNULL(np->m_mbox),
+ FENDNULL(mp->m_next->m_mbox)))
return 0;
}
if (!ccme && ismymbox (np))