- * picksbr.c -- routines to help pick along...
- *
- * This code is Copyright (c) 2002, by the authors of nmh. See the
- * COPYRIGHT file in the root directory of the nmh distribution for
- * complete copyright information.
- */
+** picksbr.c -- routines to help pick along...
+**
+** This code is Copyright (c) 2002, by the authors of nmh. See the
+** COPYRIGHT file in the root directory of the nmh distribution for
+** complete copyright information.
+*/
- * We really should be using re_comp() and re_exec() here. Unfortunately,
- * pick advertises that lowercase characters matches characters of both
- * cases. Since re_exec() doesn't exhibit this behavior, we are stuck
- * with this version. Furthermore, we need to be able to save and restore
- * the state of the pattern matcher in order to do things "efficiently".
- *
- * The matching power of this algorithm isn't as powerful as the re_xxx()
- * routines (no \(xxx\) and \n constructs). Such is life.
- */
+** We really should be using re_comp() and re_exec() here. Unfortunately,
+** pick advertises that lowercase characters matches characters of both
+** cases. Since re_exec() doesn't exhibit this behavior, we are stuck
+** with this version. Furthermore, we need to be able to save and restore
+** the state of the pattern matcher in order to do things "efficiently".
+**
+** The matching power of this algorithm isn't as powerful as the re_xxx()
+** routines (no \(xxx\) and \n constructs). Such is life.
+*/
{
int i;
register char *cp, *dp;
char buffer[BUFSIZ], temp[64];
register struct nexus *n;
{
int i;
register char *cp, *dp;
char buffer[BUFSIZ], temp[64];
register struct nexus *n;
- if ((n = parse ()) == NULL) {
- padvise (NULL, "missing group");
+ if ((n = parse()) == NULL) {
+ padvise(NULL, "missing group");
- if ((cp = nxtarg ()) == NULL) {
- padvise (NULL, "missing -rbrace");
+ if ((cp = nxtarg()) == NULL) {
+ padvise(NULL, "missing -rbrace");
case PRSUBJ:
strncpy(temp, parswit[i].sw, sizeof(temp));
temp[sizeof(temp) - 1] = '\0';
case PRSUBJ:
strncpy(temp, parswit[i].sw, sizeof(temp));
temp[sizeof(temp) - 1] = '\0';
- dp = *brkstring (temp, " ", NULL);
- header: ;
- if (!(cp = nxtarg ())) {/* allow -xyz arguments */
- padvise (NULL, "missing argument to %s", argp[-2]);
+ dp = *brkstring(temp, " ", NULL);
+header: ;
+ if (!(cp = nxtarg())) { /* allow -xyz arguments */
+ padvise(NULL, "missing argument to %s",
+ argp[-2]);
- snprintf (buffer, sizeof(buffer), "^%s[ \t]*:.*%s", dp, cp);
+ snprintf(buffer, sizeof(buffer), "^%s[ \t]*:.*%s",
+ dp, cp);
- if (!(cp = nxtarg ())) {/* allow -xyz arguments */
- padvise (NULL, "missing argument to %s", argp[-2]);
+ if (!(cp = nxtarg())) { /* allow -xyz arguments */
+ padvise(NULL, "missing argument to %s",
+ argp[-2]);
- pattern: ;
- if (!gcompile (n, dp)) {
- padvise (NULL, "pattern error in %s %s", argp[-2], cp);
+pattern: ;
+ if (!gcompile(n, dp)) {
+ padvise(NULL, "pattern error in %s %s",
+ argp[-2], cp);
- if (!(datesw = nxtarg ()) || *datesw == '-') {
- padvise (NULL, "missing argument to %s", argp[-2]);
+ if (!(datesw = nxtarg()) || *datesw == '-') {
+ padvise(NULL, "missing argument to %s",
+ argp[-2]);
- if (!(cp = nxtarg ())) {/* allow -xyz arguments */
- padvise (NULL, "missing argument to %s", argp[-2]);
+ if (!(cp = nxtarg())) { /* allow -xyz arguments */
+ padvise(NULL, "missing argument to %s",
+ argp[-2]);
- if (!tcompile (cp, &n->n_tws, n->n_after = i == PRAFTR)) {
- padvise (NULL, "unable to parse %s %s", argp[-2], cp);
+ if (!tcompile(cp, &n->n_tws, n->n_after =
+ i == PRAFTR)) {
+ padvise(NULL, "unable to parse %s %s",
+ argp[-2], cp);
- if ((p = (struct nexus *) calloc ((size_t) 1, sizeof *p)) == NULL)
- adios (NULL, "unable to allocate component storage");
+ if ((p = (struct nexus *) calloc((size_t) 1, sizeof *p)) == NULL)
+ adios(NULL, "unable to allocate component storage");
#define args(a) a, fp, msgnum, start, stop
#define args(a) a, fp, msgnum, start, stop
-pmatches (FILE *fp, int msgnum, long start, long stop)
+pmatches(FILE *fp, int msgnum, long start, long stop)
- fprintf (stderr, "OR\n");
- PRaction (n->n_L_child, level + 1);
- PRaction (n->n_R_child, level + 1);
+ fprintf(stderr, "OR\n");
+ PRaction(n->n_L_child, level + 1);
+ PRaction(n->n_R_child, level + 1);
- fprintf (stderr, "AND\n");
- PRaction (n->n_L_child, level + 1);
- PRaction (n->n_R_child, level + 1);
+ fprintf(stderr, "AND\n");
+ PRaction(n->n_L_child, level + 1);
+ PRaction(n->n_R_child, level + 1);
- fprintf (stderr, "NOT\n");
- PRaction (n->n_L_child, level + 1);
+ fprintf(stderr, "NOT\n");
+ PRaction(n->n_L_child, level + 1);
n->n_header ? "header" : "body", n->n_patbuf);
return;
}
if (n->n_action == TWSaction) {
n->n_header ? "header" : "body", n->n_patbuf);
return;
}
if (n->n_action == TWSaction) {
register char *p1, *p2, *ebp, *cbp;
char ibuf[BUFSIZ];
register char *p1, *p2, *ebp, *cbp;
char ibuf[BUFSIZ];
- snprintf (buffer, sizeof(buffer), "%s %s", ap, dtwszone (ts));
- if ((tw = dparsetime (buffer)) != NULL)
+ snprintf(buffer, sizeof(buffer), "%s %s", ap, dtwszone(ts));
+ if ((tw = dparsetime(buffer)) != NULL)
- snprintf (buffer, sizeof(buffer), "%s %02d:%02d:%02d %s", ap,
- ts->tw_hour, ts->tw_min, ts->tw_sec, dtwszone (ts));
- if ((tw = dparsetime (buffer)) != NULL)
+ snprintf(buffer, sizeof(buffer), "%s %02d:%02d:%02d %s", ap,
+ ts->tw_hour, ts->tw_min, ts->tw_sec, dtwszone(ts));
+ if ((tw = dparsetime(buffer)) != NULL)
- snprintf (buffer, sizeof(buffer), "%02d %s %04d %s",
+ snprintf(buffer, sizeof(buffer), "%02d %s %04d %s",
ts->tw_mday, tw_moty[ts->tw_mon], ts->tw_year, ap);
ts->tw_mday, tw_moty[ts->tw_mon], ts->tw_year, ap);
- snprintf (buffer, sizeof(buffer), "%02d %s %04d %s %s",
+ snprintf(buffer, sizeof(buffer), "%02d %s %04d %s %s",
ts->tw_mday, tw_moty[ts->tw_mon], ts->tw_year,
ts->tw_mday, tw_moty[ts->tw_mon], ts->tw_year,
- time (&clock);
- if (!mh_strcasecmp (ap, "today"))
- return dlocaltime (&clock);
- if (!mh_strcasecmp (ap, "yesterday")) {
+ time(&clock);
+ if (!mh_strcasecmp(ap, "today"))
+ return dlocaltime(&clock);
+ if (!mh_strcasecmp(ap, "yesterday")) {
- switch (state = m_getfld (state, name, buf, sizeof buf, fp)) {
+ switch (state = m_getfld(state, name, buf, sizeof buf, fp)) {
- state = m_getfld (state, name, buf, sizeof buf, fp);
- bp = add (buf, bp);
+ state = m_getfld(state, name, buf,
+ sizeof buf, fp);
+ bp = add(buf, bp);
- if ((tw = dparsetime (bp)) == NULL)
- advise (NULL, "unable to parse %s field in message %d, matching...",
+ if ((tw = dparsetime(bp)) == NULL)
+ advise(NULL, "unable to parse %s field in message %d, matching...",
- state = n->n_after ? (twsort (tw, &n->n_tws) > 0)
- : (twsort (tw, &n->n_tws) < 0);
+ state = n->n_after ? (twsort(tw, &n->n_tws) > 0)
+ : (twsort(tw, &n->n_tws) < 0);