/*
- * pick.c -- search for messages by content
- *
- * This code is Copyright (c) 2002, 2008, by the authors of nmh. See the
- * COPYRIGHT file in the root directory of the nmh distribution for
- * complete copyright information.
- */
+** pick.c -- search for messages by content
+**
+** This code is Copyright (c) 2002, 2008, 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>
adios (NULL, "-%s unknown", cp);
case HELPSW:
- snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
- invo_name);
+ snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
print_help (buf, switches, 1);
listsw = 0; /* HACK */
done (1);
case SRCHSW:
vec[vecp++] = --cp;
pattern:
- if (!(cp = *argp++))/* allow -xyz arguments */
- adios (NULL, "missing argument to %s", argp[-2]);
+ if (!(cp = *argp++)) /* allow -xyz arguments */
+ adios (NULL, "missing argument to %s",
+ argp[-2]);
vec[vecp++] = cp;
continue;
case OTHRSW:
case SEQSW:
if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
+ adios (NULL, "missing argument to %s",
+ argp[-2]);
/* check if too many sequences specified */
if (seqp >= NUMATTRS)
else
folder = pluspath (cp);
} else
- app_msgarg(&msgs, cp);
+ app_msgarg(&msgs, cp);
}
vec[vecp] = NULL;
free (path ("./", TFOLDER));
/*
- * If we didn't specify which messages to search,
- * then search the whole folder.
- */
+ ** If we didn't specify which messages to search,
+ ** then search the whole folder.
+ */
if (!msgs.size)
app_msgarg(&msgs, "all");
seq_setprev (mp); /* set the previous-sequence */
/*
- * If we aren't saving the results to a sequence,
- * we default to list the results.
- */
+ ** If we aren't saving the results to a sequence,
+ ** we default to list the results.
+ */
if (listsw == -1)
listsw = !seqp;
if (publicsw == 1 && is_readonly(mp))
- adios (NULL, "folder %s is read-only, so -public not allowed", folder);
+ adios (NULL, "folder %s is read-only, so -public not allowed",
+ folder);
if (!pcompile (vec, NULL))
done (1);
lo = mp->lowsel;
hi = mp->hghsel;
- /* If printing message numbers to standard out, force line buffering on.
- */
+ /*
+ ** If printing message numbers to standard out,
+ ** force line buffering on.
+ */
if (listsw)
setvbuf (stdout, NULL, _IOLBF, 0);
/*
- * Scan through all the SELECTED messages and check for a
- * match. If the message does not match, then unselect it.
- */
+ ** Scan through all the SELECTED messages and check for a
+ ** match. If the message does not match, then unselect it.
+ */
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
if (is_selected (mp, msgnum)) {
if ((fp = fopen (cp = m_name (msgnum), "r")) == NULL)
seqs[seqp] = NULL;
/*
- * Add the matching messages to sequences
- */
+ ** Add the matching messages to sequences
+ */
for (seqp = 0; seqs[seqp]; seqp++)
if (!seq_addsel (mp, seqs[seqp], publicsw, zerosw))
done (1);
/*
- * Print total matched if not printing each matched message number.
- */
+ ** Print total matched if not printing each matched message number.
+ */
if (!listsw) {
printf ("%d hit%s\n", mp->numsel, mp->numsel == 1 ? "" : "s");
}