-
-/*
- * picksbr.c -- routines to help pick along...
+/* 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
#define STAR 01
-#define LBSIZE 1024
+#define LBSIZE NMH_BUFSIZ
#define ESIZE 1024
static struct nexus *nexp1(void);
static struct nexus *nexp2(void);
static struct nexus *nexp3(void);
-static struct nexus *newnexus(int (*)());
+static struct nexus *newnexus(int (*)(struct nexus *n,
+ FILE *fp, int msgnum, long start, long stop));
-static int ORaction();
-static int ANDaction();
-static int NOTaction();
-static int GREPaction();
-static int TWSaction();
+static int ORaction(struct nexus *n, FILE *fp, int msgnum,
+ long start, long stop);
+static int ANDaction(struct nexus *n, FILE *fp, int msgnum,
+ long start, long stop);
+static int NOTaction(struct nexus *n, FILE *fp, int msgnum,
+ long start, long stop);
+static int GREPaction(struct nexus *n, FILE *fp, int msgnum,
+ long start, long stop);
+static int TWSaction(struct nexus *n, FILE *fp, int msgnum,
+ long start, long stop);
int
talked = 0;
if ((head = parse ()) == NULL)
- return (talked ? 0 : 1);
+ return !talked;
if (*argp) {
inform("%s unexpected", *argp);
static struct nexus *
-newnexus (int (*action)())
+newnexus(int (*action)(struct nexus *n, FILE *fp, int msgnum,
+ long start, long stop))
{
struct nexus *p;
}
-#define args(a) a, fp, msgnum, start, stop
-#define params args (n)
-#define plist \
- struct nexus *n; \
- FILE *fp; \
- int msgnum; \
- long start, \
- stop;
-
int
pmatches (FILE *fp, int msgnum, long start, long stop, int debug)
{
if (!talked++ && debug)
PRaction (head, 0);
- return (*head->n_action) (args (head));
+ return (*head->n_action)(head, fp, msgnum, start, stop);
}
static int
-ORaction (params)
-plist
+ORaction(struct nexus *n, FILE *fp, int msgnum, long start, long stop)
{
- if ((*n->n_L_child->n_action) (args (n->n_L_child)))
+ if ((*n->n_L_child->n_action)(n->n_L_child, fp, msgnum, start, stop))
return 1;
- return (*n->n_R_child->n_action) (args (n->n_R_child));
+ return (*n->n_R_child->n_action)(n->n_R_child, fp, msgnum, start, stop);
}
static int
-ANDaction (params)
-plist
+ANDaction(struct nexus *n, FILE *fp, int msgnum, long start, long stop)
{
- if (!(*n->n_L_child->n_action) (args (n->n_L_child)))
+ if (!(*n->n_L_child->n_action)(n->n_L_child, fp, msgnum, start, stop))
return 0;
- return (*n->n_R_child->n_action) (args (n->n_R_child));
+ return (*n->n_R_child->n_action)(n->n_R_child, fp, msgnum, start, stop);
}
static int
-NOTaction (params)
-plist
+NOTaction(struct nexus *n, FILE *fp, int msgnum, long start, long stop)
{
- return (!(*n->n_L_child->n_action) (args (n->n_L_child)));
+ return (!(*n->n_L_child->n_action)(n->n_L_child, fp, msgnum, start, stop));
}
static int
-GREPaction (params)
-plist
+GREPaction(struct nexus *n, FILE *fp, int msgnum, long start, long stop)
{
int c, body, lf;
long pos = start;
--p2;
break;
}
- else
- lf = 0;
+ lf = 0;
}
if (c == '\n') {
if (body)
break;
- else {
- if (lf) {
- body++;
- break;
- }
- lf++;
- /* Unfold by skipping the newline. */
- c = 0;
- }
+ if (lf) {
+ body++;
+ break;
+ }
+ lf++;
+ /* Unfold by skipping the newline. */
+ c = 0;
}
if (c && p1 < &linebuf[LBSIZE - 1])
*p1++ = c;
return 0;
default:
- admonish (NULL, "advance() botch -- you lose big");
+ inform("advance() botch -- you lose big, continuing...");
return 0;
}
}
if ((tw = tws_parse (ap, isafter)) == NULL)
return 0;
- twscopy (tb, tw);
+ *tb = *tw;
return 1;
}
static int
-TWSaction (params)
-plist
+TWSaction(struct nexus *n, FILE *fp, int msgnum, long start, long stop)
{
int state;
char *bp;
- char buf[BUFSIZ], name[NAMESZ];
+ char buf[NMH_BUFSIZ], name[NAMESZ];
struct tws *tw;
m_getfld_state_t gstate = 0;
NMH_UNUSED (stop);