From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-x231.google.com (mail-wi0-x231.google.com [IPv6:2a00:1450:400c:c05::231]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 9BC9D7AEF7 for ; Sat, 18 Apr 2015 05:55:22 -0700 (PDT) Received: by wicmx19 with SMTP id mx19so7559446wic.1 for ; Sat, 18 Apr 2015 05:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=ZdccDYjd3/o+Q7nGpcA3zF0ossDcZ3aNHKAAH5lSK9E=; b=xHQ+hDHYrqJIimral0kka9h709daeC90DEucRkIrz5vP0HmTCTFWvP64c45xG+xW11 GWgiNo+VSG2oEwFVFk3KOV3Z2m4Z4YoZORwVjnvpYOFakJEaV6hW/N0ffxNukOhqnKWk CfOTL5w9MHzqscDiyYD1jMfnh3mLzofAuvWbjOgidWcauUwzvr1d9NM1lVO20w4VGpQr XWi0pV97Skbo2nObaruOHWo4v6W0ZsRNZaC6b3DhGcRLiBjfORrtEltbvDkJfmD6YDtc 92ftk5PwfLTx9DFPknJa7b/wnrxrsrmwqNyZnWClD3snWYObxzDA0MnW9ZGj5gJvKpl/ dqFA== X-Received: by 10.194.60.173 with SMTP id i13mr14241410wjr.124.1429361656523; Sat, 18 Apr 2015 05:54:16 -0700 (PDT) Received: from toaster.adamthompson.me.uk (toaster.adamthompson.me.uk. [2001:8b0:1142:9042::2]) by mx.google.com with ESMTPSA id fv2sm633161wjb.6.2015.04.18.05.54.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Apr 2015 05:54:15 -0700 (PDT) Date: Sat, 18 Apr 2015 13:54:13 +0100 From: Adam Thompson To: Karl Dahlke Message-ID: <20150418125413.GL5949@toaster.adamthompson.me.uk> References: <20150316174053.eklhad@comcast.net> <20150418104919.GI5949@toaster.adamthompson.me.uk> <20150318083645.eklhad@comcast.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KIbT1ud6duwZIwNL" Content-Disposition: inline In-Reply-To: <20150318083645.eklhad@comcast.net> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: Edbrowse-dev@lists.the-brannons.com Subject: Re: [Edbrowse-dev] wordexp again X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Apr 2015 12:55:23 -0000 --KIbT1ud6duwZIwNL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 18, 2015 at 08:36:45AM -0400, Karl Dahlke wrote: > > I notice you miss out the ~whatever expansion here, >=20 > No, I get that for free. > It's handled by glob(). > And it works, and it's pretty cool. > I don't have a lot of use for it but I like it. Ok, never knew glob did that, that's cool. One thing puzzles me about the changes though: =20 /* But first see if the user wants to glob */ if (varline[0] =3D=3D '~') { char c =3D varline[1]; if (!c) goto doglob; if (c =3D=3D '/') goto doglob; if (isalphaByte(c)) goto doglob; } for (s =3D varline; *s; ++s) if (strchr("*?[", *s) && (s =3D=3D varline || s[-1] !=3D '\\')) goto doglob; noglob: *expanded =3D varline; return true; I thought we were using globbing so that we didn't have nasty side-effects, and I'm not entirely sure what this check solves. If there are metacharacters in the expanded line by this point and they're unescaped then we'll glob, otherwise they're correctly escaped and thus globbing wouldn't do any harm anyway. In addition glob appears to handle a ] without a [ etc, so again this check seems somewhat redundant. As for the r5 (or r) problem which is what I guess this is trying to solve, that number shouldn't have gone anywhere near this function since, as far as I know, r is illegal and should be r = anyway. Cheers, Adam. --KIbT1ud6duwZIwNL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVMlP1AAoJELZ22lNQBzHOLzMIAKaV5QGfl9hNF4pRVcEJNwCc r8L2YLgTgp8CBs1Fcxmoeh3Z/nJZ+Oo9GOfG8XyGfmqCQkpND6vtP6ebxu8d52Es OQZJf6fTbUESOGFE61/YRAfejaMq04WCarNFLbkje7e+NYsiYj/q1kcJc1dOLOim aWqHmM4cLwvsjS8BHYgx3y4v7cz5RPZzJnYtCyTjo3oJcupeRI/vAzEByiD1wuVc 1P911XThQNFNgdIrpFvY1r77iwZLF65MW5/7CleFWbf+l/s+PMrOzMC0F5XobzFe wrIJzD6w8/kmZ6ZyLpC5QehpVWz64E8WdCw3aTImVlkCMvFN+mE0fELocoic4jE= =4fcI -----END PGP SIGNATURE----- --KIbT1ud6duwZIwNL--