From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31731 invoked by alias); 22 Dec 2007 18:05:58 -0000 Received: (qmail 31723 invoked by uid 22791); 22 Dec 2007 18:05:58 -0000 X-Spam-Check-By: sourceware.org Received: from romy.inter.net.il (HELO romy.inter.net.il) (213.8.233.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 22 Dec 2007 18:05:47 +0000 Received: from HOME-C4E4A596F7 (IGLD-84-229-233-247.inter.net.il [84.229.233.247]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id JRL67893 (AUTH halo1); Sat, 22 Dec 2007 20:05:00 +0200 (IST) Date: Sat, 22 Dec 2007 19:27:00 -0000 Message-Id: From: Eli Zaretskii To: Denis PILAT CC: drow@false.org, gdb-patches@sourceware.org In-reply-to: <476BCE30.50803@st.com> (message from Denis PILAT on Fri, 21 Dec 2007 15:31:12 +0100) Subject: Re: [RFC] usage of environment variable from the command line Reply-to: Eli Zaretskii References: <46F13F2A.8010507@st.com> <20070921225527.GA28500@caradoc.them.org> <20070922135839.GA6285@caradoc.them.org> <20070930012955.GA29254@caradoc.them.org> <476BCE30.50803@st.com> 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-12/txt/msg00397.txt.bz2 > Date: Fri, 21 Dec 2007 15:31:12 +0100 > From: Denis PILAT > Cc: gdb-patches@sourceware.org > > The old discussion was here: > http://sources.redhat.com/ml/gdb-patches/2007-09/msg00430.html > My point is: > - What do you mean by a specification ? That question was directed at Daniel, not you. > - You also told about quoting issues, could you please be more precise ? That was Daniel, so he should respond. I guess he meant literal "${" strings, which could legitimately be part of input. > +#define ENV_DELIMITOR_BEGIN "${" > +#define ENV_DELIMITOR_END "}" Please use DELIMITER, not DELIMITOR. > + int env_var_len, delimitor_begin_len, delimitor_end_len; ^^^^^^^^^ ^^^^^^^^^ Same here. > + delimitor_begin_len = strlen(ENV_DELIMITOR_BEGIN); > + delimitor_end_len = strlen(ENV_DELIMITOR_END); Coding style: a space between function's name and the left parenthesis. > + /* replace this value into the original string. */ > + output = xmalloc (strlen (input) + strlen (env_var_value) - env_var_len - delimitor_begin_len - delimitor_end_len + 1); This line is too long, please break into two. > + p = evaluate_environment_from_string (p); Are we perhaps leaking memory pointed to by `p' before the above line executes?