aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-cmds.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2001-06-04 07:45:08 +0000
committerEli Zaretskii <eliz@gnu.org>2001-06-04 07:45:08 +0000
commitfe4e3eb861f34aedece88a642124ef1b0601cf4d (patch)
tree4f338782875e8c0036cecbbc6a96d4aa5b89639e /gdb/cli/cli-cmds.c
parent37ba1196cfa445fc376f312d4152486692ce50b1 (diff)
downloadfsf-binutils-gdb-fe4e3eb861f34aedece88a642124ef1b0601cf4d.zip
fsf-binutils-gdb-fe4e3eb861f34aedece88a642124ef1b0601cf4d.tar.gz
fsf-binutils-gdb-fe4e3eb861f34aedece88a642124ef1b0601cf4d.tar.bz2
* source.c (mod_path, openp): Use HAVE_DOS_BASED_FILE_SYSTEM
instead of system-specific define's like _WIN32 and __MSDOS__. Use IS_DIR_SEPARATOR and IS_ABSOLUTE_PATH instead of SLASH_P and ROOTED_P. (top-level): #include "filenames.h". * solib.c (solib_open): Use IS_DIR_SEPARATOR and IS_ABSOLUTE_PATH instead of SLASH_CHAR, ROOTED_P and SLASH_P. (top-level): #include "filenames.h". * defs.h (SLASH_P, SLASH_CHAR, ROOTED_P): Remove definitions. (SLASH_STRING): Define only for _WIN32. * completer.c: Use HAVE_DOS_BASED_FILE_SYSTEM instead of __MSDOS_. * cli/cli-cmds.c (cd_command): Use IS_DIR_SEPARATOR and IS_ABSOLUTE_PATH instead of SLASH_P and ROOTED_P. Replace system-specific ifdefs with HAVE_DOS_BASED_FILE_SYSTEM. (top-level): #include "filenames.h".
Diffstat (limited to 'gdb/cli/cli-cmds.c')
-rw-r--r--gdb/cli/cli-cmds.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index c1c5f7b..ca700ed 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -23,6 +23,7 @@
#include "target.h" /* For baud_rate, remote_debug and remote_timeout */
#include "gdb_wait.h" /* For shell escape implementation */
#include "gnu-regex.h" /* Used by apropos_command */
+#include "filenames.h" /* for DOSish file names */
#ifdef UI_OUT
#include "ui-out.h"
@@ -292,7 +293,7 @@ cd_command (char *dir, int from_tty)
if (chdir (dir) < 0)
perror_with_name (dir);
-#if defined(_WIN32) || defined(__MSDOS__)
+#if HAVE_DOS_BASED_FILE_SYSTEM
/* There's too much mess with DOSish names like "d:", "d:.",
"d:./foo" etc. Instead of having lots of special #ifdef'ed code,
simply get the canonicalized name of the current directory. */
@@ -300,24 +301,24 @@ cd_command (char *dir, int from_tty)
#endif
len = strlen (dir);
- if (SLASH_P (dir[len - 1]))
+ if (IS_DIR_SEPARATOR (dir[len - 1]))
{
/* Remove the trailing slash unless this is a root directory
(including a drive letter on non-Unix systems). */
if (!(len == 1) /* "/" */
-#if defined(_WIN32) || defined(__MSDOS__)
- && !(!SLASH_P (*dir) && ROOTED_P (dir) && len <= 3) /* "d:/" */
+#if HAVE_DOS_BASED_FILE_SYSTEM
+ && !(len == 3 && dir[1] == ':') /* "d:/" */
#endif
)
len--;
}
dir = savestring (dir, len);
- if (ROOTED_P (dir))
+ if (IS_ABSOLUTE_PATH (dir))
current_directory = dir;
else
{
- if (SLASH_P (current_directory[strlen (current_directory) - 1]))
+ if (IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]))
current_directory = concat (current_directory, dir, NULL);
else
current_directory = concat (current_directory, SLASH_STRING, dir, NULL);
@@ -329,17 +330,18 @@ cd_command (char *dir, int from_tty)
found_real_path = 0;
for (p = current_directory; *p;)
{
- if (SLASH_P (p[0]) && p[1] == '.' && (p[2] == 0 || SLASH_P (p[2])))
+ if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.'
+ && (p[2] == 0 || IS_DIR_SEPARATOR (p[2])))
strcpy (p, p + 2);
- else if (SLASH_P (p[0]) && p[1] == '.' && p[2] == '.'
- && (p[3] == 0 || SLASH_P (p[3])))
+ else if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.' && p[2] == '.'
+ && (p[3] == 0 || IS_DIR_SEPARATOR (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 && !SLASH_P (q[-1]))
+ while (q != current_directory && !IS_DIR_SEPARATOR (q[-1]))
--q;
if (q == current_directory)