1/* VMS 64bit crt0 returning VMS style condition codes .
2   Copyright (C) 2001 Free Software Foundation, Inc.
3   Contributed by Douglas B. Rupp (rupp@gnat.com).
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12In addition to the permissions in the GNU General Public License, the
13Free Software Foundation gives you unlimited permission to link the
14compiled version of this file into combinations with other programs,
15and to distribute those combinations without any restriction coming
16from the use of this file.  (The General Public License restrictions
17do apply in other respects; for example, they cover modification of
18the file, and distribution when not linked into a combine
19executable.)
20
21GNU CC is distributed in the hope that it will be useful,
22but WITHOUT ANY WARRANTY; without even the implied warranty of
23MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24GNU General Public License for more details.
25
26You should have received a copy of the GNU General Public License
27along with GNU CC; see the file COPYING.  If not, write to
28the Free Software Foundation, 59 Temple Place - Suite 330,
29Boston, MA 02111-1307, USA.  */
30
31#if !defined(__DECC)
32You Lose! This file can only be compiled with DEC C.
33#else
34
35/* This file can only be compiled with DEC C, due to the call to
36   lib$establish and the pragmas pointer_size.  */
37
38#pragma __pointer_size short
39
40#include <stdlib.h>
41#include <string.h>
42#include <ssdef.h>
43
44extern void decc$main ();
45
46extern int main ();
47
48static int
49handler (sigargs, mechargs)
50     void *sigargs;
51     void *mechargs;
52{
53  return SS$_RESIGNAL;
54}
55
56int
57__main (arg1, arg2, arg3, image_file_desc, arg5, arg6)
58     void *arg1, *arg2, *arg3;
59     void *image_file_desc;
60     void *arg5, *arg6;
61{
62  int argc;
63  char **argv;
64  char **envp;
65
66#pragma __pointer_size long
67
68  int i;
69  char **long_argv;
70  char **long_envp;
71
72#pragma __pointer_size short
73
74  lib$establish (handler);
75  decc$main (arg1, arg2, arg3, image_file_desc,
76	     arg5, arg6, &argc, &argv, &envp);
77
78#pragma __pointer_size long
79
80  /* Reallocate argv with 64 bit pointers. */
81  long_argv = (char **) malloc (sizeof (char *) * (argc + 1));
82
83  for (i = 0; i < argc; i++)
84    long_argv[i] = strdup (argv[i]);
85
86  long_argv[argc] = (char *) 0;
87
88  long_envp = (char **) malloc (sizeof (char *) * 5);
89
90  for (i = 0; envp[i]; i++)
91    long_envp[i] = strdup (envp[i]);
92
93  long_envp[i] = (char *) 0;
94
95#pragma __pointer_size short
96
97  return main (argc, long_argv, long_envp);
98}
99#endif
100