From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21277 invoked by alias); 24 Sep 2007 16:44:04 -0000 Received: (qmail 21262 invoked by uid 22791); 24 Sep 2007 16:44:03 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 24 Sep 2007 16:44:00 +0000 Received: (qmail 9232 invoked from network); 24 Sep 2007 16:43:55 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 24 Sep 2007 16:43:55 -0000 To: Eli Zaretskii Cc: denis.pilat@st.com, gdb-patches@sourceware.org Subject: Re: [RFC] usage of environment variable from the command line References: <46F13F2A.8010507@st.com> <20070921225527.GA28500@caradoc.them.org> <20070922135839.GA6285@caradoc.them.org> From: Jim Blandy Date: Mon, 24 Sep 2007 16:44:00 -0000 In-Reply-To: <20070922135839.GA6285@caradoc.them.org> (Daniel Jacobowitz's message of "Sat, 22 Sep 2007 09:58:39 -0400") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-09/txt/msg00343.txt.bz2 Daniel Jacobowitz writes: > On Sat, Sep 22, 2007 at 09:16:38AM +0200, Eli Zaretskii wrote: >> > Before we go ahead with this can anyone think of a better one that >> > won't conflict with source language expressions? >> >> How about env("FOO") ? Or maybe $env("FOO"), to avoid a possibility >> that the debuggee has a real function by the name of `env'? > > I like $env("FOO") or $ENV("FOO"). > >> > Another problem is escaping. Right now, you're supposed to be able to >> > give either quoted strings or raw text to most commands (it >> > varies, I posted a summary a while back). Front ends won't know how >> > to escape the string if you have e.g. %% in your $PWD or want to >> > print a string containing %%. >> >> The above suggestion solves this problem as well, I think. > > Mostly yes. The context where environment variables would be most > useful is in places we don't take expressions, like after the > "file" command; we've been changing those to take quoted strings > to handle spaces and backslashes safely, so we could allow > backslash to escape dollar sign too. > > Do we want environment variable support only for things that take text > (pathnames, filenames, string values), or do we also want it in C > expression contexts? If only the former, maybe $ENV(HOME) without > the inner quotes; quotes are already special. I think we want it in both places. In general, the syntax for substituting such variables into source-language expressions would need to be language-specific to avoid changing the meaning of any normal expression. So that would need to be done on a language-by-language basis. For the other cases, this is bikesheddy of me, but why not simply ${HOME}, braces required?