aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>1995-06-12 20:07:45 +0000
committerStan Shebs <shebs@codesourcery.com>1995-06-12 20:07:45 +0000
commit2e1cc80191239d77f2d084e30a9c3b4460b29503 (patch)
tree304a4476948e46d586aafae863ef5580751c3d45 /gdb/top.c
parent43b442f17c70392033a9a3e82b5b26f5cb42d22a (diff)
downloadgdb-2e1cc80191239d77f2d084e30a9c3b4460b29503.zip
gdb-2e1cc80191239d77f2d084e30a9c3b4460b29503.tar.gz
gdb-2e1cc80191239d77f2d084e30a9c3b4460b29503.tar.bz2
Windows support bits from Steve Chamberlain <sac@slash.cygnus.com>.
* defs.h: Don't declare strchr and friends if WIN32. (DIRNAME_SEPARATOR): Move here from source.c. (SLASH_P, SLASH_CHAR, SLASH_STRING, ROOTED_P): New macros, symbolic definitions for filename bits. * top.c (cd_command): Use these. * source.c (mod_path, openp): Ditto. * terminal.h: Disable termio/sgtty definitions if WIN32. * findvar.c (registers_changed): Call registers_changed_hook if it is defined.
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/top.c b/gdb/top.c
index a3bc4bb..0c95852 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2832,15 +2832,15 @@ cd_command (dir, from_tty)
perror_with_name (dir);
len = strlen (dir);
- dir = savestring (dir, len - (len > 1 && dir[len-1] == '/'));
- if (dir[0] == '/')
+ dir = savestring (dir, len - (len > 1 && SLASH_P(dir[len-1])));
+ if (ROOTED_P(dir))
current_directory = dir;
else
{
- if (current_directory[0] == '/' && current_directory[1] == '\0')
+ if (SLASH_P (current_directory[0]) && current_directory[1] == '\0')
current_directory = concat (current_directory, dir, NULL);
else
- current_directory = concat (current_directory, "/", dir, NULL);
+ current_directory = concat (current_directory, SLASH_STRING, dir, NULL);
free (dir);
}
@@ -2849,17 +2849,17 @@ cd_command (dir, from_tty)
found_real_path = 0;
for (p = current_directory; *p;)
{
- if (p[0] == '/' && p[1] == '.' && (p[2] == 0 || p[2] == '/'))
+ if (SLASH_P (p[0]) && p[1] == '.' && (p[2] == 0 || SLASH_P (p[2])))
strcpy (p, p + 2);
- else if (p[0] == '/' && p[1] == '.' && p[2] == '.'
- && (p[3] == 0 || p[3] == '/'))
+ else if (SLASH_P (p[0]) && p[1] == '.' && p[2] == '.'
+ && (p[3] == 0 || SLASH_P (p[3])))
{
if (found_real_path)
{
/* Search backwards for the directory just before the "/.."
and obliterate it and the "/..". */
char *q = p;
- while (q != current_directory && q[-1] != '/')
+ while (q != current_directory && ! SLASH_P (q[-1]))
--q;
if (q == current_directory)