[2016-09-20 16:56] Dmitry Bogatov <kact...@gnu.org>
> Seems, symlink replacement of 'scan' is not part of this patch, isn't it?

No, I have written this patch to have some code to discuss
and get a response from markus what he thinks now about merging
scan and pick. Thats why I have focused on the actuall code not
on the buildsystem changes.

> > [2016-09-09 19:45] Philipp Takacs <phil...@bureaucracy.de>
> > --- 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 wid
> th);
> 
> static?

Yes.

> 
> > -        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.

Yes this will be part of an other commit, I have just seen it and fixed it.

> > @@ -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?

Will be removed on the final commit.

> > +void printmsg(FILE *f, struct msgs *mp, int msgnum, char *fmtstr, int wid
> th)
> > +{
> > +   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?

I have more or less just copied the code from uip/scan.c (line 209).
The cases are merged there, too. I have looked a bit into it now.
It's because, if scan() fails there is nothing we can do about it.

Philipp

Reply via email to