summaryrefslogtreecommitdiff
path: root/gcc/prefix.c
diff options
context:
space:
mode:
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>1998-03-27 14:20:40 +0000
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>1998-03-27 14:20:40 +0000
commit055237ef6e56039d5402c8b69d46ee5b6bbfbb23 (patch)
treef06b6290931d772238b161a0ba2613657a9e454e /gcc/prefix.c
parent55d6e079c79f511f927b52cb449084c56a654527 (diff)
downloadgcc-055237ef6e56039d5402c8b69d46ee5b6bbfbb23.tar.gz
Make GCC_EXEC_PREFIX work again
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@18856 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/prefix.c')
-rw-r--r--gcc/prefix.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/gcc/prefix.c b/gcc/prefix.c
index f270172e5fa..c07944764d4 100644
--- a/gcc/prefix.c
+++ b/gcc/prefix.c
@@ -1,5 +1,5 @@
/* Utility to update paths from internal to external forms.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -76,6 +76,8 @@ Boston, MA 02111-1307, USA. */
#include "gansidecl.h"
+static char *std_prefix = PREFIX;
+
static char *get_key_value PROTO((char *));
static char *translate_name PROTO((char *));
static char *concat PVPROTO((char *, ...));
@@ -93,16 +95,20 @@ get_key_value (key)
char *key;
{
char *prefix = 0;
+ char *temp = 0;
#ifdef _WIN32
prefix = lookup_key (key);
#endif
if (prefix == 0)
- prefix = getenv (concat (key, "_ROOT", NULL_PTR));
+ prefix = getenv (temp = concat (key, "_ROOT", NULL_PTR));
if (prefix == 0)
- prefix = PREFIX;
+ prefix = std_prefix;
+
+ if (temp)
+ free (temp);
return prefix;
}
@@ -259,7 +265,7 @@ translate_name (name)
{
prefix = get_key_value (key);
if (prefix == 0)
- prefix = PREFIX;
+ prefix = std_prefix;
}
else
{
@@ -289,12 +295,12 @@ update_path (path, key)
char *path;
char *key;
{
- if (! strncmp (path, PREFIX, strlen (PREFIX)) && key != 0)
+ if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
{
if (key[0] != '$')
key = concat ("@", key, NULL_PTR);
- path = concat (key, &path[strlen (PREFIX)], NULL_PTR);
+ path = concat (key, &path[strlen (std_prefix)], NULL_PTR);
while (path[0] == '@' || path[0] == '$')
path = translate_name (path);
@@ -315,3 +321,12 @@ update_path (path, key)
return path;
}
+
+/* Reset the standard prefix */
+void
+set_std_prefix (prefix, len)
+ char *prefix;
+ int len;
+{
+ std_prefix = save_string (prefix, len);
+}