aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/env.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2019-07-18 16:37:40 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2019-07-18 18:37:40 +0200
commita6fc663e311b2b862373e4a4f3ee7d6836acb1a2 (patch)
tree6d0223791c112e5b47e7dd4a5dc668f65c71ca4f /gcc/ada/env.c
parentb9a0100963b357e7e84084e45bbc51d6576410a4 (diff)
downloadgcc-a6fc663e311b2b862373e4a4f3ee7d6836acb1a2.zip
gcc-a6fc663e311b2b862373e4a4f3ee7d6836acb1a2.tar.gz
gcc-a6fc663e311b2b862373e4a4f3ee7d6836acb1a2.tar.bz2
Makefile.rtl, [...]: Introduce a "STANDALONE" mode where C runtime files do not have any dependency...
* Makefile.rtl, expect.c, env.c, aux-io.c, mkdir.c, initialize.c, cstreams.c, raise.c, tracebak.c, adadecode.c, init.c, raise-gcc.c, argv.c, adaint.c, adaint.h, ctrl_c.c, sysdep.c, rtinit.c, cio.c, seh_init.c, exit.c, targext.c: Introduce a "STANDALONE" mode where C runtime files do not have any dependency on GCC include files. Remove unnecessary includes. Remove remaining references to VMS in runtime C file. * runtime.h: new File. From-SVN: r273576
Diffstat (limited to 'gcc/ada/env.c')
-rw-r--r--gcc/ada/env.c108
1 files changed, 8 insertions, 100 deletions
diff --git a/gcc/ada/env.c b/gcc/ada/env.c
index 04e861e..698b177 100644
--- a/gcc/ada/env.c
+++ b/gcc/ada/env.c
@@ -30,15 +30,11 @@
****************************************************************************/
#ifdef IN_RTS
-# include "tconfig.h"
-# include "tsystem.h"
+# include "runtime.h"
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
-# include <sys/stat.h>
-# include <fcntl.h>
-# include <time.h>
-# ifdef VMS
-# include <unixio.h>
-# endif
/* We don't have libiberty, so use malloc. */
# define xmalloc(S) malloc (S)
#else /* IN_RTS */
@@ -109,89 +105,10 @@ __gnat_getenv (char *name, int *len, char **value)
return;
}
-/* VMS specific declarations for set_env_value. */
-
-#ifdef VMS
-
-typedef struct _ile3
-{
- unsigned short len, code;
- __char_ptr32 adr;
- __char_ptr32 retlen_adr;
-} ile_s;
-
-#endif
-
void
__gnat_setenv (char *name, char *value)
{
-#if defined (VMS)
- struct dsc$descriptor_s name_desc;
- $DESCRIPTOR (table_desc, "LNM$PROCESS");
- char *host_pathspec = value;
- char *copy_pathspec;
- int num_dirs_in_pathspec = 1;
- char *ptr;
- long status;
-
- name_desc.dsc$w_length = strlen (name);
- name_desc.dsc$b_dtype = DSC$K_DTYPE_T;
- name_desc.dsc$b_class = DSC$K_CLASS_S;
- name_desc.dsc$a_pointer = name; /* ??? Danger, not 64bit safe. */
-
- if (*host_pathspec == 0)
- /* deassign */
- {
- status = LIB$DELETE_LOGICAL (&name_desc, &table_desc);
- /* no need to check status; if the logical name is not
- defined, that's fine. */
- return;
- }
-
- ptr = host_pathspec;
- while (*ptr++)
- if (*ptr == ',')
- num_dirs_in_pathspec++;
-
- {
- int i, status;
- /* Alloca is guaranteed to be 32bit. */
- ile_s *ile_array = alloca (sizeof (ile_s) * (num_dirs_in_pathspec + 1));
- char *copy_pathspec = alloca (strlen (host_pathspec) + 1);
- char *curr, *next;
-
- strcpy (copy_pathspec, host_pathspec);
- curr = copy_pathspec;
- for (i = 0; i < num_dirs_in_pathspec; i++)
- {
- next = strchr (curr, ',');
- if (next == 0)
- next = strchr (curr, 0);
-
- *next = 0;
- ile_array[i].len = strlen (curr);
-
- /* Code 2 from lnmdef.h means it's a string. */
- ile_array[i].code = 2;
- ile_array[i].adr = curr;
-
- /* retlen_adr is ignored. */
- ile_array[i].retlen_adr = 0;
- curr = next + 1;
- }
-
- /* Terminating item must be zero. */
- ile_array[i].len = 0;
- ile_array[i].code = 0;
- ile_array[i].adr = 0;
- ile_array[i].retlen_adr = 0;
-
- status = LIB$SET_LOGICAL (&name_desc, 0, &table_desc, 0, ile_array);
- if ((status & 1) != 1)
- LIB$SIGNAL (status);
- }
-
-#elif (defined (__vxworks) && defined (__RTP__)) || defined (__APPLE__)
+#if (defined (__vxworks) && defined (__RTP__)) || defined (__APPLE__)
setenv (name, value, 1);
#else
@@ -213,10 +130,7 @@ __gnat_setenv (char *name, char *value)
char **
__gnat_environ (void)
{
-#if defined (VMS) || defined (RTX)
- /* Not implemented */
- return NULL;
-#elif defined (__MINGW32__)
+#if defined (__MINGW32__)
return _environ;
#elif defined (__sun__)
extern char **_environ;
@@ -247,10 +161,7 @@ __gnat_environ (void)
void __gnat_unsetenv (char *name)
{
-#if defined (VMS)
- /* Not implemented */
- return;
-#elif defined (__hpux__) || defined (__sun__) \
+#if defined (__hpux__) || defined (__sun__) \
|| (defined (__vxworks) && ! defined (__RTP__)) \
|| defined (_AIX) || defined (__Lynx__)
@@ -306,10 +217,7 @@ void __gnat_unsetenv (char *name)
void __gnat_clearenv (void)
{
-#if defined (VMS)
- /* not implemented */
- return;
-#elif defined (__sun__) \
+#if defined (__sun__) \
|| (defined (__vxworks) && ! defined (__RTP__)) || defined (__Lynx__) \
|| defined (__PikeOS__)
/* On Solaris, VxWorks (not RTPs), and Lynx there is no system