diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2002-12-13 17:55:49 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2002-12-13 17:55:49 +0000 |
commit | c04e0a08c9ced78d9a762969c584e64b5eca1d7a (patch) | |
tree | 298fe8023addbc7e510f87c3bb9d98985e4748d5 /gdb/source.c | |
parent | 068890be59b98a2f5e269cbc070f6d3f36676aca (diff) | |
download | gdb-c04e0a08c9ced78d9a762969c584e64b5eca1d7a.zip gdb-c04e0a08c9ced78d9a762969c584e64b5eca1d7a.tar.gz gdb-c04e0a08c9ced78d9a762969c584e64b5eca1d7a.tar.bz2 |
2002-12-13 Jeff Johnston <jjohnstn@redhat.com>
* defs.h (init_last_source_visited): New prototype.
(add_path): Ditto.
* source.c (add_path): New function that adds to a specified path.
(mod_path): Change to call add_path.
(init_last_source_visited): New function to allow interfaces to
initialize static variable: last_source_visited. Part of fix
for PR gdb/741.
* Makefile.in: Add support for mi/mi-cmd-env.c.
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/gdb/source.c b/gdb/source.c index be5d90c..c2991b5 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -358,6 +358,12 @@ init_source_path (void) forget_cached_source_info (); } +void +init_last_source_visited (void) +{ + last_source_visited = NULL; +} + /* Add zero or more directories to the front of the source path. */ void @@ -388,6 +394,18 @@ directory_command (char *dirname, int from_tty) void mod_path (char *dirname, char **which_path) { + add_path (dirname, which_path, 1); +} + +/* Workhorse of mod_path. Takes an extra argument to determine + if dirname should be parsed for separators that indicate multiple + directories. This allows for interfaces that pre-parse the dirname + and allow specification of traditional separator characters such + as space or tab. */ + +void +add_path (char *dirname, char **which_path, int parse_separators) +{ char *old = *which_path; int prefix = 0; @@ -404,9 +422,16 @@ mod_path (char *dirname, char **which_path) struct stat st; { - char *separator = strchr (name, DIRNAME_SEPARATOR); - char *space = strchr (name, ' '); - char *tab = strchr (name, '\t'); + char *separator = NULL; + char *space = NULL; + char *tab = NULL; + + if (parse_separators) + { + separator = strchr (name, DIRNAME_SEPARATOR); + space = strchr (name, ' '); + tab = strchr (name, '\t'); + } if (separator == 0 && space == 0 && tab == 0) p = dirname = name + strlen (name); @@ -537,7 +562,8 @@ mod_path (char *dirname, char **which_path) tinybuf[0] = DIRNAME_SEPARATOR; tinybuf[1] = '\0'; - /* If we have already tacked on a name(s) in this command, be sure they stay on the front as we tack on some more. */ + /* If we have already tacked on a name(s) in this command, be sure they stay + on the front as we tack on some more. */ if (prefix) { char *temp, c; |