[PATCH] basic modelines for contrib/nvi

José de Paula espinafre at gmail.com
Sun Jul 18 14:46:34 PDT 2004


On Sun, 18 Jul 2004 16:55:41 +0300, Giorgos Keramidas
<keramida at ceid.upatras.gr> wrote:
> On 2004-07-14 23:51, Jos? de Paula <espinafre at gmail.com> wrote:
> > I hacked together this little patch to contrib/nvi to make it support
> > simple modelines. [snip]
> 
> > +
> > +     if (O_ISSET(sp, O_MODELINE)) {
> > +             cmd = get_modeline(sp);
> > +             if (cmd != NULL)
> > +                     if (ex_run_str(sp, "modeline", cmd, strlen(cmd), 0, 0))
> > +                             return;
> > +     }
> > +
> 
> Just a minor comment.
> 
> Nested if's like the second & third above look like a natural place to
> use && as in:
> 
>         if (O_ISSET(sp, O_MODELINE)) {
>                 cmd = get_modeline(sp);
>                 if (cmd != NULL &&
> 
> 
>                     ex_run_str(sp, "modeline", cmd, strlen(cmd), 0, 0))
>                         return;
>         }
> 
> Giorgos
> 

A small overlook on my part, thanks for pointing it.

So, what do you think about it, overall? This patch recognizes one and
only one modeline, and runs it. Should we look for all possible
modelines and run all of them? In this case, in what order should we
check for them?

And, concerning the security, what are the implications of this patch?
I cannot see any obvious blunder, so if you find anyone please let me
know.


More information about the freebsd-hackers mailing list