From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23414 invoked by alias); 18 Nov 2005 13:53:58 -0000 Received: (qmail 23405 invoked by uid 22791); 18 Nov 2005 13:53:55 -0000 Received: from romy.inter.net.il (HELO romy.inter.net.il) (192.114.186.66) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 18 Nov 2005 13:53:55 +0000 Received: from HOME-C4E4A596F7 (IGLD-80-230-65-87.inter.net.il [80.230.65.87]) by romy.inter.net.il (MOS 3.5.8-GR) with ESMTP id CZT21701 (AUTH halo1); Fri, 18 Nov 2005 15:53:27 +0200 (IST) Date: Fri, 18 Nov 2005 14:53:00 -0000 Message-Id: From: Eli Zaretskii To: Andrew STUBBS CC: gdb-patches@sources.redhat.com In-reply-to: <437DC94B.7060601@st.com> (message from Andrew STUBBS on Fri, 18 Nov 2005 12:30:03 +0000) Subject: Re: [PATCH] Use search path for scripts Reply-to: Eli Zaretskii References: <437B6718.7070300@st.com> <437C6D69.1030209@st.com> <437DC94B.7060601@st.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2005-11/txt/msg00326.txt.bz2 > Date: Fri, 18 Nov 2005 12:30:03 +0000 > From: Andrew STUBBS > Cc: gdb-patches@sources.redhat.com > > Fair enough. As you say, I can probably solve this part of the problem a > different way, or else just keep a (much smaller) local patch. > > Here is the patch adjusted as you request. This is fine with me, thanks. > - stream = fopen (file, FOPEN_RT); > - if (!stream) > + /* Search for and open 'file' on the search path used for source > + files. Put the full location in 'full_pathname'. */ > + fd = openp (source_path, OPF_TRY_CWD_FIRST, > + file, O_RDONLY, 0, &full_pathname); > + > + /* Use the full path name, if it is found. */ > + if (full_pathname != NULL && fd != -1) > + { > + file = full_pathname; > + } > + > + if (fd == -1) > { > source_verbose = old_source_verbose; > if (from_tty) > @@ -496,6 +510,7 @@ source_command (char *args, int from_tty > return; > } > > + stream = fdopen (fd, "r"); ^^^ Shouldn't this be FOPEN_RT, like what was used in the call to fopen in the original code?