> [2016-09-09 19:45] Philipp Takacs <[email protected]>
> > It wouldn't be that complicate. We would to replace the
> >
> > > printf("%s\n", m_name(msgnum));
> >
> > with a call to scan() and add the ``-format'' switch.
> >
>
> I have implemented this to have a code example we can discouse
> not only an idea. The patch is attached.
Thank for you work.
> > In other words pick supports only the format '=%(msg)' at
> > the moment. If we have a format switch in pick we could replace
> > scan by a symlink to pick.
Seems, symlink replacement of 'scan' is not part of this patch, isn't it?
> --- a/uip/pick.c
> +++ b/uip/pick.c
> @@ -83,10 +89,12 @@ static int listsw = -1;
>
> void putzero_done();
>
> +void printmsg(FILE *f, struct msgs *mp, int msgnum, char *fmtstr, int width);
static?
> - if (atexit(putzero_done) != 0) {
> + if (atexit(putzero_done) != 0) {
> adios(EX_OSERR, NULL, "atexit failed");
> }
Seems to fix spacing error, but it probably belong to another patch.
> @@ -271,8 +299,10 @@ main(int argc, char **argv)
> if (msgnum > hi)
> hi = msgnum;
>
> - if (listsw)
> - printf("%s\n", m_name(msgnum));
> + if (listsw) {
> + printmsg(fp, mp, msgnum, fmtstr, width);
> + /* printf("%s\n", m_name(msgnum)); */
> + }
Commented code?
> +void printmsg(FILE *f, struct msgs *mp, int msgnum, char *fmtstr, int width)
> +{
> + int seqnum;
> + int state;
> + boolean unseen = FALSE;
> +
> + fseek(f, 0L, SEEK_SET);
> +
> + seqnum = seq_getnum(mp, seq_unseen);
> + unseen = in_sequence(mp, seqnum, msgnum);
> +
> + switch (state = scan(f, msgnum, SCN_FOLD, fmtstr,
> + width, msgnum==mp->curmsg, unseen)) {
> + case SCNMSG:
> + case SCNERR:
> + break;
Why cases
#define SCNMSG 1 /* message just fine */
#define SCNERR (-1) /* error message */
are merged?