From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-x22b.google.com (mail-wg0-x22b.google.com [IPv6:2a00:1450:400c:c00::22b]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 3ADA077CD1 for ; Sun, 28 Dec 2014 11:38:09 -0800 (PST) Received: by mail-wg0-f43.google.com with SMTP id l18so17550545wgh.30 for ; Sun, 28 Dec 2014 11:35:54 -0800 (PST) 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=HNlFHr/L9eKFegCgEPX1AJ8JWAt3mhZEs9an3yM4vAg=; b=RyEUBIbdeTjz9Q9usO/S0SKIQz/U2jl8GcAnA1hN6Oro/1NHDccG/MjFediHFk/2Cx 5wSGw5sCC4uh4fMiNRp+LQQcCfbq0BOKDTTEK+bXIIkPCVyyr9wxe7iCEElMaCJkPDOY EVAjuNUVGmOYB3Crb0LbFUO+NDC1M27Kzcm+h3jxMHTzZI0AyZoEEJSB+ave2FETG4iv 6Xm5esE7l+b29jU9f+02pK1zAimw119q2Hjit8PhNcg9Hs54/ZYhWPDhdYikUwnF8XFU rA6xHiUlsY/CIC7Yk8icyU/nl2oGHZnrCCt4xzWuFt7Nm9c9gxXcy35668VGJEN507TM Qvjw== X-Received: by 10.180.208.79 with SMTP id mc15mr57244545wic.34.1419795354008; Sun, 28 Dec 2014 11:35:54 -0800 (PST) Received: from spoons.adamthompson.me.uk (8.3.3.3.0.d.e.f.f.f.2.d.4.2.2.0.5.9.a.d.8.a.b.f.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:fba8:da95:224:d2ff:fed0:3338]) by mx.google.com with ESMTPSA id b10sm669245wjr.32.2014.12.28.11.35.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Dec 2014 11:35:53 -0800 (PST) Date: Sun, 28 Dec 2014 19:35:50 +0000 From: Adam Thompson To: Karl Dahlke Message-ID: <20141228193550.GB16901@spoons.adamthompson.me.uk> References: <20141128140919.eklhad@comcast.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="b5gNqxB1S1yM7hjW" Content-Disposition: inline In-Reply-To: <20141128140919.eklhad@comcast.net> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: Edbrowse-dev@lists.the-brannons.com Subject: Re: [Edbrowse-dev] glob, wordexp 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: Sun, 28 Dec 2014 19:38:09 -0000 --b5gNqxB1S1yM7hjW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 28, 2014 at 02:09:19PM -0500, Karl Dahlke wrote: > Edbrowse has the feature that you can read or write files using shell var= iables > and even wildcard expansion, if the result is one file. > I use this feature all the time! >=20 > r ~/work/whatever/st*k.c > w $backup/12-25-14.c >=20 > and things like that. Wow, I knew about ~ expansion and env variables but didn't know about wildc= ards. > Most of this is done by envFile() in stringfile.c, > which is 200 lines of rather awkward code. > I would like to replace most of this with a call to glob or wordexp. > This leverages existing libraries, and is more portable, > since someone else is reading through subdirectories etc. Agreed. > Are there any reasons I should or should not do this, or any thoughts on = this? > I know glob does too little, it doesn't expand shell variables, > but wordexp may do too much, > like all the fancy things bash does to a line. Yeah, wordexp does massive amounts of things (including command substitutio= n). Looking through the man page, the only thing you can turn off is the comman= d substitution. This essentially means that any file names you give it *must* be in legal p= osix shell syntax which may or may not be an issue. I'd say you should go with wordexp (may as well leave in the command substitution since that could be quite powerful) as long as you make sure that the readline tab completion feature yields file names escaped for use in the shell. On a semi-related note, what're people's thoughts on enabling readline's hi= story feature? I personally find myself wanting this on an almost daily basis, but didn't want to do it in case there's a good reason not to. Cheers, Adam. --b5gNqxB1S1yM7hjW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUoFuWAAoJELZ22lNQBzHO7dEH/2xVn1xj3dOlIce2ZsLt61lH 27E2YqN7o+rSgQnMwlOrmp7N9/hBfL90Dlb2FC0jVTfE45DuZ2qwA2vMASSAMfP6 AFuc4/yQBVjFd9PsCk/Fa+Ez7FeR5Mbk6YZ9gxxNsJTumY4SuYfIkCbOoCNBWuzP JfWYEcsLO0l9YUkMHzl0Ke/pNu9hF3ccVznW05rwmhJzhvRM7D2iGa5oZtxDKx/M FlUgbgBs4swcBywF/kis1dJqp0+EDG2IFJbYUOFuEsk1VnM7d+tORnNx9qLNE8V6 P7oufYVNPQeXG26HFBQnhKs1b42i9k8kNGzP+ITPpwi/Vskrt6xkdUC+l8FQJPk= =KFeT -----END PGP SIGNATURE----- --b5gNqxB1S1yM7hjW--