From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 18 21:46:34 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A087F16A4CE for ; Sun, 18 Jul 2004 21:46:34 +0000 (GMT) Received: from mproxy.gmail.com (mproxy.gmail.com [216.239.56.242]) by mx1.FreeBSD.org (Postfix) with SMTP id 92D8B43D54 for ; Sun, 18 Jul 2004 21:46:34 +0000 (GMT) (envelope-from espinafre@gmail.com) Received: by mproxy.gmail.com with SMTP id r62so637234cwc for ; Sun, 18 Jul 2004 14:46:34 -0700 (PDT) Received: by 10.11.119.3 with SMTP id r3mr246794cwc; Sun, 18 Jul 2004 14:46:34 -0700 (PDT) Message-ID: <5ef8c2f0040718144648b49ff6@mail.gmail.com> Date: Sun, 18 Jul 2004 18:46:34 -0300 From: =?ISO-8859-1?Q?Jos=E9_de_Paula?= To: Giorgos Keramidas In-Reply-To: <20040718135541.GA28115@gothmog.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <5ef8c2f004071419517bdc9f3e@mail.gmail.com> <20040718135541.GA28115@gothmog.gr> cc: freebsd-hackers@freebsd.org Subject: Re: [PATCH] basic modelines for contrib/nvi X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2004 21:46:34 -0000 On Sun, 18 Jul 2004 16:55:41 +0300, Giorgos Keramidas wrote: > On 2004-07-14 23:51, Jos? de Paula 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.