- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2007 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by
your option) any later version.
GCC is distributed in the hope that it will be useful,
your option) any later version.
GCC is distributed in the hope that it will be useful,
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
-License along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+License along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
/* This file contains routines to update a path, both to canonicalize
the directory format and to handle any prefix translation.
/* This file contains routines to update a path, both to canonicalize
the directory format and to handle any prefix translation.
if (reg_key == (HKEY) INVALID_HANDLE_VALUE)
{
res = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE", 0,
if (reg_key == (HKEY) INVALID_HANDLE_VALUE)
{
res = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE", 0,
- res = RegOpenKeyExA (reg_key, "Free Software Foundation", 0,
- KEY_READ, ®_key);
+ res = RegOpenKeyExA (reg_key, "Free Software Foundation", 0,
+ KEY_READ, ®_key);
- res = RegOpenKeyExA (reg_key, WIN32_REGISTRY_KEY, 0,
- KEY_READ, ®_key);
+ res = RegOpenKeyExA (reg_key, WIN32_REGISTRY_KEY, 0,
+ KEY_READ, ®_key);
key = (char *) alloca (keylen + 1);
strncpy (key, &name[1], keylen);
key[keylen] = 0;
if (code == '@')
key = (char *) alloca (keylen + 1);
strncpy (key, &name[1], keylen);
key[keylen] = 0;
if (code == '@')
- sometimes yield a result with no separator when one was coded
- and intended by the user, causing two path components to run
- together. */
+ sometimes yield a result with no separator when one was coded
+ and intended by the user, causing two path components to run
+ together. */
- && IS_DIR_SEPARATOR (p[2])
- && (p != result && IS_DIR_SEPARATOR (p[-1])))
- {
- *p = 0;
- if (!ALWAYS_STRIP_DOTDOT && access (result, X_OK) == 0)
- {
- *p = '.';
- break;
- }
- else
- {
- /* We can't access the dir, so we won't be able to
- access dir/.. either. Strip out `dir/../'. If `dir'
- turns out to be `.', strip one more path component. */
- dest = p;
- do
- {
- --dest;
- while (dest != result && IS_DIR_SEPARATOR (*dest))
- --dest;
- while (dest != result && !IS_DIR_SEPARATOR (dest[-1]))
- --dest;
- }
- while (dest != result && *dest == '.');
- /* If we have something like `./..' or `/..', don't
- strip anything more. */
- if (*dest == '.' || IS_DIR_SEPARATOR (*dest))
- {
- *p = '.';
- break;
- }
- src = p + 3;
- while (IS_DIR_SEPARATOR (*src))
- ++src;
- p = dest;
- while ((*dest++ = *src++) != 0)
- ;
- }
- }
+ && IS_DIR_SEPARATOR (p[2])
+ && (p != result && IS_DIR_SEPARATOR (p[-1])))
+ {
+ *p = 0;
+ if (!ALWAYS_STRIP_DOTDOT && access (result, X_OK) == 0)
+ {
+ *p = '.';
+ break;
+ }
+ else
+ {
+ /* We can't access the dir, so we won't be able to
+ access dir/.. either. Strip out `dir/../'. If `dir'
+ turns out to be `.', strip one more path component. */
+ dest = p;
+ do
+ {
+ --dest;
+ while (dest != result && IS_DIR_SEPARATOR (*dest))
+ --dest;
+ while (dest != result && !IS_DIR_SEPARATOR (dest[-1]))
+ --dest;
+ }
+ while (dest != result && *dest == '.');
+ /* If we have something like `./..' or `/..', don't
+ strip anything more. */
+ if (*dest == '.' || IS_DIR_SEPARATOR (*dest))
+ {
+ *p = '.';
+ break;
+ }
+ src = p + 3;
+ while (IS_DIR_SEPARATOR (*src))
+ ++src;
+ p = dest;
+ while ((*dest++ = *src++) != 0)
+ ;
+ }
+ }