From 2e1cc80191239d77f2d084e30a9c3b4460b29503 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Mon, 12 Jun 1995 20:07:45 +0000 Subject: [PATCH] Windows support bits from Steve Chamberlain . * 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. --- gdb/ChangeLog | 13 +++++++++++++ gdb/top.c | 16 ++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4d639bfbfe1..aebb3bd2293 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +Mon Jun 12 12:48:13 1995 Stan Shebs + + Windows support bits from Steve Chamberlain . + * 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. + Mon Jun 12 12:22:05 1995 J.T. Conklin * Makefile.in (distclean, realclean): Remove config.cache and diff --git a/gdb/top.c b/gdb/top.c index a3bc4bb113c..0c958528d93 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)