From 78dabc95d53fa3a6c41039456eeec9ac9763fea8 Mon Sep 17 00:00:00 2001
From: Doug Rupp <rupp@adacore.com>
Date: Tue, 29 Mar 2005 18:13:31 +0200
Subject: [PATCH] adaint.c (__gnat_to_canonical_file_spec [VMS]): Check for
 logical name and translate.

2005-03-29  Doug Rupp  <rupp@adacore.com>

	* adaint.c (__gnat_to_canonical_file_spec [VMS]): Check for logical
	name and translate.

From-SVN: r97167
---
 gcc/ada/adaint.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index fbb67afca020..2195b4965329 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -2204,18 +2204,29 @@ __gnat_to_canonical_dir_spec (char *dirspec, int prefixflag)
 }
 
 /* Translate a VMS syntax file specification into Unix syntax.
-   If no indicators of VMS syntax found, return input string.  */
+   If no indicators of VMS syntax found, check if its an uppercase
+   alphanumeric_ name and if so try it out as an environment
+   variable (logical name). If all else fails return the
+   input string.  */
 
 char *
 __gnat_to_canonical_file_spec (char *filespec)
 {
+  char *filespec1;
+
   strncpy (new_canonical_filespec, "", MAXPATH);
 
   if (strchr (filespec, ']') || strchr (filespec, ':'))
     {
       strncpy (new_canonical_filespec,
-	       (char *) decc$translate_vms (filespec),
-	       MAXPATH);
+	       (char *) decc$translate_vms (filespec), MAXPATH);
+    }
+  else if ((strlen (filespec) == strspn (filespec,
+	    "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"))
+	&& (filespec1 = getenv (filespec)))
+    {
+      strncpy (new_canonical_filespec,
+	       (char *) decc$translate_vms (filespec1), MAXPATH);
     }
   else
     {
-- 
GitLab