/*
- * 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.
+*/
#include <h/mh.h>
#include <h/tws.h>
/* DEFINITIONS FOR PATTERN MATCHING */
/*
- * 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.
+*/
#define CCHR 2
#define CDOT 4
};
/*
- * DEFINITIONS FOR NEXUS
- */
+** DEFINITIONS FOR NEXUS
+*/
#define nxtarg() (*argp ? *argp++ : NULL)
#define prvarg() argp--
static struct nexus *head;
/*
- * prototypes for date routines
- */
+** prototypes for date routines
+*/
static struct tws *tws_parse();
static struct tws *tws_special();
/*
- * static prototypes
- */
+** static prototypes
+*/
static void PRaction();
static int gcompile();
static int advance();
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]);
+header: ;
+ if (!(cp = nxtarg ())) { /* allow -xyz arguments */
+ padvise (NULL, "missing argument to %s",
+ argp[-2]);
return NULL;
}
n = newnexus (GREPaction);
n->n_header = 1;
- snprintf (buffer, sizeof(buffer), "^%s[ \t]*:.*%s", dp, cp);
+ snprintf (buffer, sizeof(buffer), "^%s[ \t]*:.*%s",
+ dp, cp);
dp = buffer;
goto pattern;
case PRSRCH:
n = newnexus (GREPaction);
n->n_header = 0;
- 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]);
return NULL;
}
dp = cp;
- pattern: ;
+pattern: ;
if (!gcompile (n, dp)) {
- padvise (NULL, "pattern error in %s %s", argp[-2], cp);
+ padvise (NULL, "pattern error in %s %s",
+ argp[-2], cp);
return NULL;
}
n->n_patbuf = getcpy (dp);
case PRDATF:
if (!(datesw = nxtarg ()) || *datesw == '-') {
- padvise (NULL, "missing argument to %s", argp[-2]);
+ padvise (NULL, "missing argument to %s",
+ argp[-2]);
return NULL;
}
return nexp3 ();
case PRAFTR:
case PRBEFR:
- 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]);
return NULL;
}
n = newnexus (TWSaction);
n->n_datef = datesw;
if (!tcompile (cp, &n->n_tws, n->n_after = i == PRAFTR)) {
- padvise (NULL, "unable to parse %s %s", argp[-2], cp);
+ padvise (NULL, "unable to parse %s %s",
+ argp[-2], cp);
return NULL;
}
return n;
free (bp), bp = NULL;
bp = add (buf, NULL);
while (state == FLDPLUS) {
- state = m_getfld (state, name, buf, sizeof buf, fp);
+ state = m_getfld (state, name, buf,
+ sizeof buf, fp);
bp = add (buf, bp);
}
if (!mh_strcasecmp (name, n->n_datef))