mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-29 06:44:27 +08:00
collect2.c (find_a_file): Use HAVE_DOS_BASED_FILE_SYSTEM in place of the DIR_SEPARATOR test.
* collect2.c (find_a_file): Use HAVE_DOS_BASED_FILE_SYSTEM in place of the DIR_SEPARATOR test. Consider any file starting with a drivename to be absolute. If the absolute filename test fails and EXECUTABLE_SUFFIX is defined, append EXECUTABLE_SUFFIX to the file and try again. * cppinit.c (base_name): Use HAVE_DOS_BASED_FILE_SYSTEM in place of __MSDOS__ and _WIN32. * cppfiles.c (simplify_pathname): Likewise. * gcc.c (IS_DIR_SEPARATOR): Define new macro. Returns true if a character is a directory separator. (find_a_file): Use it. (convert_filename): Likewise. (process_command): Likewise. (do_spec_1): Likewise. (is_directory): Likewise. (main): Likewise. * prefix.c (IS_DIR_SEPARATOR): Define. Tests whether a character is a directory separator. (translate_name): Use it. (update_path): Change DIR_SEPARATOR_2 to DIR_SEPARATOR. Fix warning in block where '/' is changed to DIR_SEPARATOR. * i386/xm-djgpp.h (DIR_SEPARATOR): Set to '/'. (DIR_SEPARATOR_2): New macro. Set to '\'. (HAVE_DOS_BASED_FILESYS): Define. * i386/xm-mingw32.h: Updated copyright. Set DIR_SEPARATOR_2 to '/'. Define HAVE_DOS_BASED_FILE_SYSTEM. * i386/xm-os2.h: Likewise. * winnt/xm-winnt.h: Likewise. * i386/xm-dos.h: Likewise. Add copyright. From-SVN: r26328
This commit is contained in:
parent
c44033714b
commit
509781a4d1
@ -1,3 +1,35 @@
|
||||
Sat Apr 10 05:14:50 1999 Mark Elbrecht <snowball3@usa.net>
|
||||
|
||||
* collect2.c (find_a_file): Use HAVE_DOS_BASED_FILE_SYSTEM in place
|
||||
of the DIR_SEPARATOR test.
|
||||
Consider any file starting with a drivename to be absolute.
|
||||
If the absolute filename test fails and EXECUTABLE_SUFFIX is
|
||||
defined, append EXECUTABLE_SUFFIX to the file and try again.
|
||||
* cppinit.c (base_name): Use HAVE_DOS_BASED_FILE_SYSTEM
|
||||
in place of __MSDOS__ and _WIN32.
|
||||
* cppfiles.c (simplify_pathname): Likewise.
|
||||
* gcc.c (IS_DIR_SEPARATOR): Define new macro. Returns true if a
|
||||
character is a directory separator.
|
||||
(find_a_file): Use it.
|
||||
(convert_filename): Likewise.
|
||||
(process_command): Likewise.
|
||||
(do_spec_1): Likewise.
|
||||
(is_directory): Likewise.
|
||||
(main): Likewise.
|
||||
* prefix.c (IS_DIR_SEPARATOR): Define. Tests whether a character is
|
||||
a directory separator.
|
||||
(translate_name): Use it.
|
||||
(update_path): Change DIR_SEPARATOR_2 to DIR_SEPARATOR. Fix
|
||||
warning in block where '/' is changed to DIR_SEPARATOR.
|
||||
* i386/xm-djgpp.h (DIR_SEPARATOR): Set to '/'.
|
||||
(DIR_SEPARATOR_2): New macro. Set to '\'.
|
||||
(HAVE_DOS_BASED_FILESYS): Define.
|
||||
* i386/xm-mingw32.h: Updated copyright. Set
|
||||
DIR_SEPARATOR_2 to '/'. Define HAVE_DOS_BASED_FILE_SYSTEM.
|
||||
* i386/xm-os2.h: Likewise.
|
||||
* winnt/xm-winnt.h: Likewise.
|
||||
* i386/xm-dos.h: Likewise. Add copyright.
|
||||
|
||||
1999-04-10 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* pdp11.h (TARGET_SWITCHES): Add option to vary assembler syntax.
|
||||
|
@ -823,9 +823,8 @@ find_a_file (pprefix, name)
|
||||
/* Determine the filename to execute (special case for absolute paths). */
|
||||
|
||||
if (*name == '/'
|
||||
#ifdef DIR_SEPARATOR
|
||||
|| (DIR_SEPARATOR == '\\' && name[1] == ':'
|
||||
&& (name[2] == DIR_SEPARATOR || name[2] == '/'))
|
||||
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
|
||||
|| (*name && name[1] == ':')
|
||||
#endif
|
||||
)
|
||||
{
|
||||
@ -839,6 +838,16 @@ find_a_file (pprefix, name)
|
||||
return temp;
|
||||
}
|
||||
|
||||
#ifdef EXECUTABLE_SUFFIX
|
||||
/* Some systems have a suffix for executable files.
|
||||
So try appending that. */
|
||||
strcpy (temp, name);
|
||||
strcat (temp, EXECUTABLE_SUFFIX);
|
||||
|
||||
if (access (temp, X_OK) == 0)
|
||||
return temp;
|
||||
#endif
|
||||
|
||||
if (debug)
|
||||
fprintf (stderr, " - failed to locate using absolute path\n");
|
||||
}
|
||||
|
@ -28,7 +28,11 @@ Boston, MA 02111-1307, USA. */
|
||||
#define EXECUTABLE_SUFFIX ".exe"
|
||||
|
||||
/* Even though we support "/", allow "\" since everybody tests both. */
|
||||
#define DIR_SEPARATOR '\\'
|
||||
#define DIR_SEPARATOR '/'
|
||||
#define DIR_SEPARATOR_2 '\\'
|
||||
|
||||
/* Allow test for DOS drive names. */
|
||||
#define HAVE_DOS_BASED_FILESYSTEM
|
||||
|
||||
#define NO_SYS_SIGLIST 1
|
||||
|
||||
|
@ -1,3 +1,23 @@
|
||||
/* Configuration for GNU C-compiler for Intel 80386 running DOS.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU CC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "i386/xm-i386.h"
|
||||
|
||||
/* Use semicolons to separate elements of a path. */
|
||||
@ -5,6 +25,10 @@
|
||||
|
||||
/* Use backslashs to separate levels of directory. */
|
||||
#define DIR_SEPARATOR '\\'
|
||||
#define DIR_SEPARATOR_2 '/'
|
||||
|
||||
/* Allow checks for drive names. */
|
||||
#define HAVE_DOS_BASED_FILE_SYSTEM
|
||||
|
||||
/* Suffix for executable file names. */
|
||||
#define EXECUTABLE_SUFFIX ".exe"
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Configuration for GNU C-compiler for hosting on Windows32.
|
||||
using GNU tools and the Windows32 API Library.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
@ -36,6 +36,12 @@ Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Even though we support "/", allow "\" since everybody tests both. */
|
||||
#define DIR_SEPARATOR '\\'
|
||||
#define DIR_SEPARATOR_2 '/'
|
||||
|
||||
/* Mingw32 does not try to hide the underlying DOS-based file system
|
||||
like Cygwin does. */
|
||||
#define HAVE_DOS_BASED_FILE_SYSTEM
|
||||
|
||||
#define EXECUTABLE_SUFFIX ".exe"
|
||||
|
||||
#undef PATH_SEPARATOR
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Configuration for GNU compiler
|
||||
for an Intel i386 or later processor running OS/2 2.x.
|
||||
Copyright (C) 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1994, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
Contributed by Samuel Figueroa (figueroa@apple.com)
|
||||
|
||||
This file is part of GNU CC.
|
||||
@ -54,6 +54,12 @@ int spawnvp (int modeflag, char *path, char *argv[]);
|
||||
#ifndef DIR_SEPARATOR
|
||||
#define DIR_SEPARATOR '\\'
|
||||
#endif
|
||||
#ifndef DIR_SEPARATOR_2
|
||||
#define DIR_SEPARATOR_2 '/'
|
||||
#endif
|
||||
|
||||
/* Allow handling of drive names. */
|
||||
#define HAVE_DOS_BASED_FILE_SYSTEM
|
||||
|
||||
#define EXECUTABLE_SUFFIX ".exe"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Configuration for GNU compiler for processor running Windows NT 3.x.
|
||||
Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1995, 1997, 1999 Free Software Foundation, Inc.
|
||||
Contributed by Douglas B. Rupp (drupp@cs.washington.edu)
|
||||
|
||||
This file is part of GNU CC.
|
||||
@ -47,7 +47,12 @@ Boston, MA 02111-1307, USA. */
|
||||
#define OBJECT_SUFFIX ".obj"
|
||||
#define EXECUTABLE_SUFFIX ".exe"
|
||||
#define PATH_SEPARATOR ';'
|
||||
|
||||
#define DIR_SEPARATOR '\\'
|
||||
#define DIR_SEPARATOR_2 '/'
|
||||
|
||||
/* Allows checks for drive names. */
|
||||
#define HAVE_DOS_BASED_FILE_SYSTEM
|
||||
|
||||
#define S_IRUSR 0000400
|
||||
#define S_IWUSR 0000200
|
||||
|
@ -1168,7 +1168,7 @@ simplify_pathname (path)
|
||||
char *base;
|
||||
int absolute = 0;
|
||||
|
||||
#if defined _WIN32 || defined __MSDOS__
|
||||
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
||||
/* Convert all backslashes to slashes. */
|
||||
for (from = path; *from; from++)
|
||||
if (*from == '\\') *from = '/';
|
||||
|
@ -430,7 +430,7 @@ base_name (fname)
|
||||
{
|
||||
char *s = (char *)fname;
|
||||
char *p;
|
||||
#if defined (__MSDOS__) || defined (_WIN32)
|
||||
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
||||
if (ISALPHA (s[0]) && s[1] == ':') s += 2;
|
||||
if ((p = rindex (s, '\\'))) s = p + 1;
|
||||
#elif defined VMS
|
||||
|
64
gcc/gcc.c
64
gcc/gcc.c
@ -66,6 +66,14 @@ compilation is specified by a string called a "spec". */
|
||||
#define DIR_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
/* Define IS_DIR_SEPARATOR. */
|
||||
#ifndef DIR_SEPARATOR_2
|
||||
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
|
||||
#else /* DIR_SEPARATOR_2 */
|
||||
# define IS_DIR_SEPARATOR(ch) \
|
||||
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
|
||||
#endif /* DIR_SEPARATOR_2 */
|
||||
|
||||
static char dir_separator_str[] = {DIR_SEPARATOR, 0};
|
||||
|
||||
#define obstack_chunk_alloc xmalloc
|
||||
@ -1991,10 +1999,12 @@ find_a_file (pprefix, name, mode)
|
||||
|
||||
/* Determine the filename to execute (special case for absolute paths). */
|
||||
|
||||
if (*name == '/' || *name == DIR_SEPARATOR
|
||||
if (IS_DIR_SEPARATOR (*name)
|
||||
#ifdef HAVE_DOS_BASED_FILESYSTEM
|
||||
/* Check for disk name on MS-DOS-based systems. */
|
||||
|| (DIR_SEPARATOR == '\\' && name[1] == ':'
|
||||
&& (name[2] == DIR_SEPARATOR || name[2] == '/')))
|
||||
|| (name[0] && name[1] == ':' && IS_DIR_SEPARATOR (name[2]))
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (access (name, mode) == 0)
|
||||
{
|
||||
@ -2434,7 +2444,7 @@ convert_filename (name, do_exe)
|
||||
return name;
|
||||
|
||||
for (i = len - 1; i >= 0; i--)
|
||||
if (name[i] == '/' || name[i] == DIR_SEPARATOR)
|
||||
if (IS_DIR_SEPARATOR (name[i]))
|
||||
break;
|
||||
|
||||
for (i++; i < len; i++)
|
||||
@ -2597,13 +2607,12 @@ process_command (argc, argv)
|
||||
{
|
||||
int len = strlen (gcc_exec_prefix);
|
||||
if (len > (int) sizeof ("/lib/gcc-lib/")-1
|
||||
&& (gcc_exec_prefix[len-1] == '/'
|
||||
|| gcc_exec_prefix[len-1] == DIR_SEPARATOR))
|
||||
&& (IS_DIR_SEPARATOR (gcc_exec_prefix[len-1])))
|
||||
{
|
||||
temp = gcc_exec_prefix + len - sizeof ("/lib/gcc-lib/") + 1;
|
||||
if ((*temp == '/' || *temp == DIR_SEPARATOR)
|
||||
if (IS_DIR_SEPARATOR (*temp)
|
||||
&& strncmp (temp+1, "lib", 3) == 0
|
||||
&& (temp[4] == '/' || temp[4] == DIR_SEPARATOR)
|
||||
&& IS_DIR_SEPARATOR (temp[4])
|
||||
&& strncmp (temp+5, "gcc-lib", 7) == 0)
|
||||
len -= sizeof ("/lib/gcc-lib/") - 1;
|
||||
}
|
||||
@ -2630,7 +2639,7 @@ process_command (argc, argv)
|
||||
strncpy (nstore, startp, endp-startp);
|
||||
if (endp == startp)
|
||||
strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
|
||||
else if (endp[-1] != '/' && endp[-1] != DIR_SEPARATOR)
|
||||
else if (!IS_DIR_SEPARATOR (endp[-1]))
|
||||
{
|
||||
nstore[endp-startp] = DIR_SEPARATOR;
|
||||
nstore[endp-startp+1] = 0;
|
||||
@ -2664,7 +2673,7 @@ process_command (argc, argv)
|
||||
strncpy (nstore, startp, endp-startp);
|
||||
if (endp == startp)
|
||||
strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
|
||||
else if (endp[-1] != '/' && endp[-1] != DIR_SEPARATOR)
|
||||
else if (!IS_DIR_SEPARATOR (endp[-1]))
|
||||
{
|
||||
nstore[endp-startp] = DIR_SEPARATOR;
|
||||
nstore[endp-startp+1] = 0;
|
||||
@ -2697,7 +2706,7 @@ process_command (argc, argv)
|
||||
strncpy (nstore, startp, endp-startp);
|
||||
if (endp == startp)
|
||||
strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
|
||||
else if (endp[-1] != '/' && endp[-1] != DIR_SEPARATOR)
|
||||
else if (!IS_DIR_SEPARATOR (endp[-1]))
|
||||
{
|
||||
nstore[endp-startp] = DIR_SEPARATOR;
|
||||
nstore[endp-startp+1] = 0;
|
||||
@ -2902,12 +2911,10 @@ process_command (argc, argv)
|
||||
int len = strlen (value);
|
||||
if ((len == 7
|
||||
|| (len > 7
|
||||
&& (value[len - 8] == '/'
|
||||
|| value[len - 8] == DIR_SEPARATOR)))
|
||||
&& (IS_DIR_SEPARATOR (value[len - 8]))))
|
||||
&& strncmp (value + len - 7, "stage", 5) == 0
|
||||
&& ISDIGIT (value[len - 2])
|
||||
&& (value[len - 1] == '/'
|
||||
|| value[len - 1] == DIR_SEPARATOR))
|
||||
&& (IS_DIR_SEPARATOR (value[len - 1])))
|
||||
{
|
||||
if (len == 7)
|
||||
add_prefix (&include_prefixes, "include", NULL_PTR,
|
||||
@ -3074,7 +3081,7 @@ process_command (argc, argv)
|
||||
directories, so that we can search both the user specified directory
|
||||
and the standard place. */
|
||||
|
||||
if (*tooldir_prefix != '/' && *tooldir_prefix != DIR_SEPARATOR)
|
||||
if (!IS_DIR_SEPARATOR (*tooldir_prefix))
|
||||
{
|
||||
if (gcc_exec_prefix)
|
||||
{
|
||||
@ -3525,7 +3532,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
|
||||
/* Relative directories always come from -B,
|
||||
and it is better not to use them for searching
|
||||
at run time. In particular, stage1 loses */
|
||||
if (pl->prefix[0] != '/' && pl->prefix[0] != DIR_SEPARATOR)
|
||||
if (!IS_DIR_SEPARATOR (pl->prefix[0]))
|
||||
continue;
|
||||
#endif
|
||||
/* Try subdirectory if there is one. */
|
||||
@ -3582,8 +3589,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
|
||||
buffer = (char *) xrealloc (buffer, bufsize);
|
||||
strcpy (buffer, machine_suffix);
|
||||
idx = strlen (buffer);
|
||||
if (buffer[idx - 1] == '/'
|
||||
|| buffer[idx - 1] == DIR_SEPARATOR)
|
||||
if (IS_DIR_SEPARATOR (buffer[idx - 1]))
|
||||
buffer[idx - 1] = 0;
|
||||
do_spec_1 (buffer, 1, NULL_PTR);
|
||||
/* Make this a separate argument. */
|
||||
@ -3604,8 +3610,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
|
||||
buffer = (char *) xrealloc (buffer, bufsize);
|
||||
strcpy (buffer, pl->prefix);
|
||||
idx = strlen (buffer);
|
||||
if (buffer[idx - 1] == '/'
|
||||
|| buffer[idx - 1] == DIR_SEPARATOR)
|
||||
if (IS_DIR_SEPARATOR (buffer[idx - 1]))
|
||||
buffer[idx - 1] = 0;
|
||||
do_spec_1 (buffer, 1, NULL_PTR);
|
||||
/* Make this a separate argument. */
|
||||
@ -4598,7 +4603,7 @@ is_directory (path1, path2, linker)
|
||||
memcpy (path, path1, len1);
|
||||
memcpy (path + len1, path2, len2);
|
||||
cp = path + len1 + len2;
|
||||
if (cp[-1] != '/' && cp[-1] != DIR_SEPARATOR)
|
||||
if (!IS_DIR_SEPARATOR (cp[-1]))
|
||||
*cp++ = DIR_SEPARATOR;
|
||||
*cp++ = '.';
|
||||
*cp = '\0';
|
||||
@ -4646,7 +4651,8 @@ main (argc, argv)
|
||||
struct user_specs *uptr;
|
||||
|
||||
p = argv[0] + strlen (argv[0]);
|
||||
while (p != argv[0] && p[-1] != '/' && p[-1] != DIR_SEPARATOR) --p;
|
||||
while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
|
||||
--p;
|
||||
programname = p;
|
||||
|
||||
#ifdef HAVE_LC_MESSAGES
|
||||
@ -4848,14 +4854,12 @@ main (argc, argv)
|
||||
standard_exec_prefix. This lets us move the installed tree
|
||||
as a unit. If GCC_EXEC_PREFIX is defined, base
|
||||
standard_startfile_prefix on that as well. */
|
||||
if (*standard_startfile_prefix == '/'
|
||||
|| *standard_startfile_prefix == DIR_SEPARATOR
|
||||
if (IS_DIR_SEPARATOR (*standard_startfile_prefix)
|
||||
|| *standard_startfile_prefix == '$'
|
||||
#ifdef __MSDOS__
|
||||
#ifdef HAVE_DOS_BASED_FILESYSTEM
|
||||
/* Check for disk name on MS-DOS-based systems. */
|
||||
|| (standard_startfile_prefix[1] == ':'
|
||||
&& (standard_startfile_prefix[2] == DIR_SEPARATOR
|
||||
|| standard_startfile_prefix[2] == '/'))
|
||||
&& (IS_DIR_SEPARATOR (standard_startfile_prefix[2])))
|
||||
#endif
|
||||
)
|
||||
add_prefix (&startfile_prefixes, standard_startfile_prefix, "BINUTILS",
|
||||
@ -4884,7 +4888,7 @@ main (argc, argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*standard_startfile_prefix != DIR_SEPARATOR && gcc_exec_prefix)
|
||||
if (!IS_DIR_SEPARATOR (*standard_startfile_prefix) && gcc_exec_prefix)
|
||||
add_prefix (&startfile_prefixes,
|
||||
concat (gcc_exec_prefix, machine_suffix,
|
||||
standard_startfile_prefix, NULL_PTR),
|
||||
@ -5046,7 +5050,7 @@ main (argc, argv)
|
||||
|
||||
input_basename = input_filename;
|
||||
for (p = input_filename; *p; p++)
|
||||
if (*p == '/' || *p == DIR_SEPARATOR)
|
||||
if (IS_DIR_SEPARATOR (*p))
|
||||
input_basename = p + 1;
|
||||
|
||||
/* Find a suffix starting with the last period,
|
||||
|
47
gcc/prefix.c
47
gcc/prefix.c
@ -81,6 +81,17 @@ static char *lookup_key PROTO((char *));
|
||||
static HKEY reg_key = (HKEY) INVALID_HANDLE_VALUE;
|
||||
#endif
|
||||
|
||||
#ifndef DIR_SEPARATOR
|
||||
# define IS_DIR_SEPARATOR(ch) ((ch) == '/')
|
||||
#else /* DIR_SEPARATOR */
|
||||
# ifndef DIR_SEPARATOR_2
|
||||
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
|
||||
# else /* DIR_SEPARATOR && DIR_SEPARATOR_2 */
|
||||
# define IS_DIR_SEPARATOR(ch) \
|
||||
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
|
||||
# endif /* DIR_SEPARATOR && DIR_SEPARATOR_2 */
|
||||
#endif /* DIR_SEPARATOR */
|
||||
|
||||
/* Given KEY, as above, return its value. */
|
||||
|
||||
static const char *
|
||||
@ -241,11 +252,7 @@ translate_name (name)
|
||||
return name;
|
||||
|
||||
for (keylen = 0;
|
||||
(name[keylen + 1] != 0 && name[keylen + 1] != '/'
|
||||
#ifdef DIR_SEPARATOR
|
||||
&& name[keylen + 1] != DIR_SEPARATOR
|
||||
#endif
|
||||
);
|
||||
(name[keylen + 1] != 0 && !IS_DIR_SEPARATOR (name[keylen + 1]));
|
||||
keylen++)
|
||||
;
|
||||
|
||||
@ -268,11 +275,7 @@ translate_name (name)
|
||||
prefix = PREFIX;
|
||||
|
||||
/* Remove any trailing directory separator from what we got. */
|
||||
if (prefix[strlen (prefix) - 1] == '/'
|
||||
#ifdef DIR_SEPARATOR
|
||||
|| prefix[strlen (prefix) - 1] == DIR_SEPARATOR
|
||||
#endif
|
||||
)
|
||||
if (IS_DIR_SEPARATOR (prefix[strlen (prefix) - 1]))
|
||||
{
|
||||
char * temp = save_string (prefix, strlen (prefix));
|
||||
temp[strlen (temp) - 1] = 0;
|
||||
@ -300,16 +303,32 @@ update_path (path, key)
|
||||
path = translate_name (path);
|
||||
}
|
||||
|
||||
#ifdef DIR_SEPARATOR
|
||||
#ifdef DIR_SEPARATOR_2
|
||||
/* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */
|
||||
if (DIR_SEPARATOR != DIR_SEPARATOR_2)
|
||||
{
|
||||
int i;
|
||||
int len = strlen (path);
|
||||
char *new_path = save_string (path, len);
|
||||
for (i = 0; i < len; i++)
|
||||
if (new_path[i] == DIR_SEPARATOR_2)
|
||||
new_path[i] = DIR_SEPARATOR;
|
||||
path = new_path;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (DIR_SEPARATOR) && !defined (DIR_SEPARATOR_2)
|
||||
if (DIR_SEPARATOR != '/')
|
||||
{
|
||||
int i;
|
||||
int len = strlen (path);
|
||||
char *new_path = save_string (path, len);
|
||||
|
||||
path = save_string (path, len);
|
||||
for (i = 0; i < len; i++)
|
||||
if (path[i] == '/')
|
||||
path[i] = DIR_SEPARATOR;
|
||||
if (new_path[i] == '/')
|
||||
new_path[i] = DIR_SEPARATOR;
|
||||
|
||||
path = new_path;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user