aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJose Ruiz <ruiz@adacore.com>2007-08-14 10:44:42 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-08-14 10:44:42 +0200
commitfdcf961c8e31aac50b7b5f3f1a9ea4f77950c0d7 (patch)
tree58769551a8aaa1a1ef84b4d604d79c600619dd0f /gcc
parent50b8a7b807b958ca96a40cd6b892627fda9c34ef (diff)
downloadgcc-fdcf961c8e31aac50b7b5f3f1a9ea4f77950c0d7.zip
gcc-fdcf961c8e31aac50b7b5f3f1a9ea4f77950c0d7.tar.gz
gcc-fdcf961c8e31aac50b7b5f3f1a9ea4f77950c0d7.tar.bz2
adaint.c (__gnat_is_absolute_path): For VxWorks systems we accept dir/file...
2007-08-14 Jose Ruiz <ruiz@adacore.com> * adaint.c (__gnat_is_absolute_path): For VxWorks systems we accept dir/file, device:/dir/file, and device:drive_letter:/dir/file as representing absolute path names. __gnat_set_file_time_name [VMS]: Fix some 64/32 bit issues. * cstreams.c (__gnat_full_name for VxWorks): Use __gnat_is_absolute_path to detect whether we need to add the current directory to normalize the path. From-SVN: r127437
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/adaint.c34
-rw-r--r--gcc/ada/cstreams.c32
2 files changed, 51 insertions, 15 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index ff2d0a4..c0fb8d0 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -101,6 +101,7 @@
/* Header files and definitions for __gnat_set_file_time_name. */
+#define __NEW_STARLET 1
#include <vms/rms.h>
#include <vms/atrdef.h>
#include <vms/fibdef.h>
@@ -119,17 +120,18 @@
Y = tmptime * 10000000 + reftime; }
/* descrip.h doesn't have everything ... */
+typedef struct fibdef* __fibdef_ptr32 __attribute__ (( mode (SI) ));
struct dsc$descriptor_fib
{
- unsigned long fib$l_len;
- struct fibdef *fib$l_addr;
+ unsigned int fib$l_len;
+ __fibdef_ptr32 fib$l_addr;
};
/* I/O Status Block. */
struct IOSB
{
unsigned short status, count;
- unsigned long devdep;
+ unsigned int devdep;
};
static char *tryfile;
@@ -1261,7 +1263,7 @@ __gnat_set_file_time_name (char *name, time_t time_stamp)
struct
{
unsigned long long backup, create, expire, revise;
- unsigned long uic;
+ unsigned int uic;
union
{
unsigned short value;
@@ -1552,12 +1554,36 @@ __gnat_file_exists (char *name)
int
__gnat_is_absolute_path (char *name, int length)
{
+#ifdef __vxworks
+ /* On VxWorks systems, an absolute path can be represented (depending on
+ the host platform) as either /dir/file, or device:/dir/file, or
+ device:drive_letter:/dir/file. */
+
+ int index;
+
+ if (name[0] == '/')
+ return 1;
+
+ for (index = 0; index < length; index++)
+ {
+ if (name[index] == ':' &&
+ ((name[index + 1] == '/') ||
+ (isalpha (name[index + 1]) && index + 2 <= length &&
+ name[index + 2] == '/')))
+ return 1;
+
+ else if (name[index] == '/')
+ return 0;
+ }
+ return 0;
+#else
return (length != 0) &&
(*name == '/' || *name == DIR_SEPARATOR
#if defined (__EMX__) || defined (MSDOS) || defined (WINNT)
|| (length > 1 && isalpha (name[0]) && name[1] == ':')
#endif
);
+#endif
}
int
diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c
index a45487b..fe81bcb 100644
--- a/gcc/ada/cstreams.c
+++ b/gcc/ada/cstreams.c
@@ -6,7 +6,7 @@
* *
* Auxiliary C functions for Interfaces.C.Streams *
* *
- * Copyright (C) 1992-2006, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2007, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -200,6 +200,25 @@ __gnat_full_name (char *nam, char *buffer)
strncpy (buffer, __gnat_to_host_file_spec (buffer), __gnat_max_path_len);
}
+#elif defined (__vxworks)
+
+ /* On VxWorks systems, an absolute path can be represented (depending on
+ the host platform) as either /dir/file, or device:/dir/file, or
+ device:drive_letter:/dir/file. Use the __gnat_is_absolute_path
+ to verify it. */
+
+ int length;
+
+ if (__gnat_is_absolute_path (nam, strlen (nam)))
+ strcpy (buffer, nam);
+
+ else
+ {
+ length = __gnat_max_path_len;
+ __gnat_get_current_dir (buffer, &length);
+ strncat (buffer, nam, __gnat_max_path_len - length - 1);
+ }
+
#else
if (nam[0] != '/')
{
@@ -211,20 +230,11 @@ __gnat_full_name (char *nam, char *buffer)
return 0;
}
-#ifdef __vxworks
- /* On VxWorks, getcwd always returns an absolute path. But this path
- can be also a device name like "serial:". In this case '/' should not
- be appended. As on VxWorks 6.x the returned path can starts with
- the device name (ex: machine:/directory), we need to test if the last
- character of the path is ':' to know if '/' should be appended. */
- if (buffer[strlen (buffer) - 1] != ':')
- strcat (buffer, "/");
-#else
+
/* If the name returned is an absolute path, it is safe to append '/'
to the path and concatenate the name of the file. */
if (buffer[0] == '/')
strcat (buffer, "/");
-#endif
strcat (buffer, nam);
}