Glenn Burkhardt
Sat, 28 Jun 2003 10:03:14 -0700
Jeffery Honig has been unable to subscribe to the mailing list. He'd like any
comments any one has about his proposed patch. You should mail the comments
directly to him:
Jeffrey C Honig <[EMAIL PROTECTED]>
Index: h/fmt_scan.h
===================================================================
RCS file: /cvsroot/nmh/nmh/h/fmt_scan.h,v
retrieving revision 1.1.1.1
diff -u -u -r1.1.1.1 fmt_scan.h
--- h/fmt_scan.h 30 Apr 1999 18:08:34 -0000 1.1.1.1
+++ h/fmt_scan.h 27 Jun 2003 22:53:59 -0000
@@ -37,6 +37,13 @@
#define CT_MYMBOX (1<<2) /* "mymbox" test being done */
#define CT_ADDRPARSE (1<<3) /* address parse being done */
+/*
+ * c_flags bits
+ */
+#define CF_TRUE (1<<0) /* usually means component is present */
+#define CF_ADDRPARSED (2<<0) /* address has been parsed */
+#define CF_DATEFAB (3<<0) /* datefield fabricated */
+
extern int fmt_norm;
/*
Index: sbr/fmt_compile.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/fmt_compile.c,v
retrieving revision 1.5
diff -u -u -r1.5 fmt_compile.c
--- sbr/fmt_compile.c 2 Jul 2002 22:09:14 -0000 1.5
+++ sbr/fmt_compile.c 27 Jun 2003 22:53:59 -0000
@@ -443,12 +443,10 @@
if (cm->c_type & CT_DATE) {
CERROR("component used as both date and address");
}
- if (! (cm->c_type & CT_ADDRPARSE)) {
- cm->c_mn = &fmt_mnull;
- fp->f_type = preprocess;
- PUTCOMP(sp);
- cm->c_type |= (CT_ADDR | CT_ADDRPARSE);
- }
+ cm->c_mn = &fmt_mnull;
+ fp->f_type = preprocess;
+ PUTCOMP(sp);
+ cm->c_type |= (CT_ADDR | CT_ADDRPARSE);
break;
case FT_FORMATADDR:
Index: sbr/fmt_scan.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/fmt_scan.c,v
retrieving revision 1.7
diff -u -u -r1.7 fmt_scan.c
--- sbr/fmt_scan.c 2 Jul 2002 22:09:14 -0000 1.7
+++ sbr/fmt_scan.c 27 Jun 2003 22:54:00 -0000
@@ -490,7 +490,7 @@
break;
case FT_LV_COMPFLAG:
- value = fmt->f_comp->c_flags;
+ value = (fmt->f_comp->c_flags & CF_TRUE) != 0;
break;
case FT_LV_COMP:
value = (comp = fmt->f_comp)->c_text ? atoi(comp->c_text) : 0;
@@ -712,10 +712,10 @@
comp = fmt->f_comp;
if ((sp = comp->c_text) && (tws = dparsetime(sp))) {
*comp->c_tws = *tws;
- comp->c_flags = 0;
- } else if (comp->c_flags >= 0) {
+ comp->c_flags &= ~CF_TRUE;
+ } else if ((comp->c_flags & CF_DATEFAB) == 0) {
memset ((char *) comp->c_tws, 0, sizeof *comp->c_tws);
- comp->c_flags = 1;
+ comp->c_flags = CF_TRUE;
}
break;
@@ -779,6 +779,9 @@
case FT_PARSEADDR:
comp = fmt->f_comp;
+ if (comp->c_flags & CF_ADDRPARSED)
+ break;
+ comp->c_flags |= CF_ADDRPARSED;
if (comp->c_mn != &fmt_mnull)
mnfree (comp->c_mn);
if ((sp = comp->c_text) && (sp = getname(sp)) &&
@@ -805,15 +808,22 @@
if ((sp = comp->c_text) && (sp = getname(sp)) &&
(mn = getm (sp, NULL, 0, AD_NAME, NULL))) {
comp->c_mn = mn;
- comp->c_flags = ismymbox(mn);
+ if (ismymbox(mn))
+ comp->c_flags |= CF_TRUE;
+ else
+ comp->c_flags &= ~CF_TRUE;
while ((sp = getname(sp)))
- if (comp->c_flags == 0 &&
+ if ((comp->c_flags & CF_TRUE) == 0 &&
(mn = getm (sp, NULL, 0, AD_NAME, NULL)))
- comp->c_flags |= ismymbox(mn);
+ if (ismymbox(mn))
+ comp->c_flags |= CF_TRUE;
} else {
while (getname("")) /* XXX */
;
- comp->c_flags = (comp->c_text == 0);
+ if (comp->c_text == 0)
+ comp->c_flags |= CF_TRUE;
+ else
+ comp->c_flags &= ~CF_TRUE;
comp->c_mn = &fmt_mnull;
}
break;
Index: uip/fmtdump.c
===================================================================
RCS file: /cvsroot/nmh/nmh/uip/fmtdump.c,v
retrieving revision 1.5
diff -u -u -r1.5 fmtdump.c
--- uip/fmtdump.c 2 Jul 2002 22:09:14 -0000 1.5
+++ uip/fmtdump.c 27 Jun 2003 22:54:00 -0000
@@ -39,6 +39,7 @@
static void assignlabel(struct format *);
static char *f_typestr(int);
static char *c_typestr(int);
+static char *c_flagsstr(int);
static void litputs(char *);
static void litputc(char);
@@ -163,7 +164,7 @@
if (fmt->f_comp->c_type)
printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
if (fmt->f_comp->c_flags)
- printf(", c_flags %d", fmt->f_comp->c_flags);
+ printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags));
break;
case FT_LV_SEC:
@@ -195,7 +196,7 @@
if (fmt->f_comp->c_type)
printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
if (fmt->f_comp->c_flags)
- printf(", c_flags %d", fmt->f_comp->c_flags);
+ printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags));
break;
case FT_LS_ADDR:
@@ -217,7 +218,7 @@
if (fmt->f_comp->c_type)
printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
if (fmt->f_comp->c_flags)
- printf(", c_flags %d", fmt->f_comp->c_flags);
+ printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags));
break;
case FT_COMPF:
@@ -228,7 +229,7 @@
if (fmt->f_comp->c_type)
printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
if (fmt->f_comp->c_flags)
- printf(", c_flags %d", fmt->f_comp->c_flags);
+ printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags));
break;
case FT_STRF:
@@ -462,8 +463,26 @@
FNORD(CT_ADDRPARSE, "ADDRPARSE");
strcat(buf, ">");
return(buf);
-#undef FNORD
}
+
+static char *
+c_flagsstr(int t)
+{
+ register int i;
+ static char buf[64];
+
+ buf[0] = '\0';
+ if (t & ~(CF_TRUE|CF_ADDRPARSED|CF_DATEFAB))
+ printf(buf, "0x%x ", t);
+ strcat(buf, "<");
+ i = 0;
+ FNORD(CF_TRUE, "TRUE");
+ FNORD(CF_ADDRPARSED, "ADDRPARSED");
+ FNORD(CF_DATEFAB, "DATEFAM");
+ strcat(buf, ">");
+ return(buf);
+}
+#undef FNORD
static void
litputs(char *s)
Index: uip/scansbr.c
===================================================================
RCS file: /cvsroot/nmh/nmh/uip/scansbr.c,v
retrieving revision 1.5
diff -u -u -r1.5 scansbr.c
--- uip/scansbr.c 2 Jul 2002 22:09:15 -0000 1.5
+++ uip/scansbr.c 27 Jun 2003 22:54:00 -0000
@@ -331,9 +331,9 @@
if (datecomp->c_tws == NULL)
adios (NULL, "unable to allocate tws buffer");
*datecomp->c_tws = *dlocaltime ((time_t *) &st.st_mtime);
- datecomp->c_flags = -1;
+ datecomp->c_flags |= CF_DATEFAB|CF_TRUE;
} else {
- datecomp->c_flags = 0;
+ datecomp->c_flags &= ~CF_DATEFAB;
}
}
}