This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Use search path for scripts
> Date: Fri, 18 Nov 2005 12:30:03 +0000
> From: Andrew STUBBS <andrew.stubbs@st.com>
> 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?