summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-04-01 12:36:51 +0200
committerRichard Levitte <levitte@openssl.org>2016-04-01 16:23:35 +0200
commit368058d0a79d2e3b853746b09ca86679a86ac233 (patch)
tree7f4b2dd3b31f56b99c113d5a94fff46d311c8ab6
parent5902821d81ced5e7c5db972e4b569848500940f7 (diff)
Force argv to be an array of long pointers on VMS
Reverts commit 087ca80ad83071dde0bb6bc1c28c743caa00eaf8 Instead of battling the odd format of argv given to main() in default P64 mode, tell the compiler to make it an array of 64-bit pointers when compiling in P64 mode. A note is added in NOTES.VMS regarding minimum DEC C version. Reviewed-by: Andy Polyakov <appro@openssl.org>
-rw-r--r--Configurations/10-main.conf4
-rw-r--r--NOTES.VMS5
-rw-r--r--apps/apps.h15
-rw-r--r--apps/openssl.c17
-rw-r--r--apps/vms_decc_init.c2
5 files changed, 19 insertions, 24 deletions
diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
index 11ff13e348..1b32b10f3c 100644
--- a/Configurations/10-main.conf
+++ b/Configurations/10-main.conf
@@ -1763,7 +1763,7 @@ sub vms_info {
"vms-alpha-p64" => {
inherit_from => [ "vms-alpha" ],
cflags =>
- add("/POINTER_SIZE=64",
+ add("/POINTER_SIZE=64=ARGV",
sub { my @warnings =
@{vms_info()->{disable_warns_p64}};
@warnings
@@ -1796,7 +1796,7 @@ sub vms_info {
"vms-ia64-p64" => {
inherit_from => [ "vms-ia64" ],
cflags =>
- add("/POINTER_SIZE=64",
+ add("/POINTER_SIZE=64=ARGV",
sub { my @warnings =
@{vms_info()->{disable_warns_p64}};
@warnings
diff --git a/NOTES.VMS b/NOTES.VMS
index ba1dbb475d..6aeda11c77 100644
--- a/NOTES.VMS
+++ b/NOTES.VMS
@@ -18,8 +18,9 @@
An ANSI C compiled is needed among other things. This means that
VAX C is not and will not be supported.
- We have only tested with DEC C (a.k.a HP VMS C / VSI C), compiling
- with a different ANSI C compiler may require some work.
+ We have only tested with DEC C (a.k.a HP VMS C / VSI C) and require
+ version 7.1 or later. Compiling with a different ANSI C compiler may
+ require some work.
Please avoid using C RTL feature logical names DECC$* when building
and testing OpenSSL. Most of all, they can be disruptive when
diff --git a/apps/apps.h b/apps/apps.h
index 7cf0dc4b6a..434ca54b7d 100644
--- a/apps/apps.h
+++ b/apps/apps.h
@@ -445,15 +445,12 @@ typedef struct args_st {
char **argv;
} ARGS;
-#if defined(OPENSSL_SYS_VMS) && defined(__DECC)
-# pragma pointer_size save
-# pragma pointer_size 32
-typedef char **argv_t;
-# pragma pointer_size restore
-char **copy_argv(int *argc, argv_t argv);
-#else
-typedef char **argv_t;
-#endif
+/*
+ * VMS C only for now, implemented in vms_decc_init.c
+ * If other C compilers forget to terminate argv with NULL, this function
+ * can be re-used.
+ */
+char **copy_argv(int *argc, char *argv[]);
# define PW_MIN_LENGTH 4
diff --git a/apps/openssl.c b/apps/openssl.c
index b810ecf8b8..26ea449dce 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -216,7 +216,6 @@ int main(int argc, char *argv[])
FUNCTION f, *fp;
LHASH_OF(FUNCTION) *prog = NULL;
char **copied_argv = NULL;
- char **argv_alias = NULL;
char *p, *pname;
char buf[1024];
const char *prompt;
@@ -232,10 +231,8 @@ int main(int argc, char *argv[])
bio_out = dup_bio_out(FORMAT_TEXT);
bio_err = dup_bio_err(FORMAT_TEXT);
-#if defined( OPENSSL_SYS_VMS) && defined(__DECC)
- copied_argv = argv_alias = copy_argv(&argc, argv);
-#else
- argv_alias = argv;
+#if defined(OPENSSL_SYS_VMS) && defined(__DECC)
+ copied_argv = argv = copy_argv(&argc, argv);
#endif
p = getenv("OPENSSL_DEBUG_MEMORY");
@@ -259,22 +256,22 @@ int main(int argc, char *argv[])
goto end;
prog = prog_init();
- pname = opt_progname(argv_alias[0]);
+ pname = opt_progname(argv[0]);
/* first check the program name */
f.name = pname;
fp = lh_FUNCTION_retrieve(prog, &f);
if (fp != NULL) {
- argv_alias[0] = pname;
- ret = fp->func(argc, argv_alias);
+ argv[0] = pname;
+ ret = fp->func(argc, argv);
goto end;
}
/* If there is stuff on the command line, run with that. */
if (argc != 1) {
argc--;
- argv_alias++;
- ret = do_cmd(prog, argc, argv_alias);
+ argv++;
+ ret = do_cmd(prog, argc, argv);
if (ret < 0)
ret = 0;
goto end;
diff --git a/apps/vms_decc_init.c b/apps/vms_decc_init.c
index 8f8ffc6753..ecf21afb6e 100644
--- a/apps/vms_decc_init.c
+++ b/apps/vms_decc_init.c
@@ -106,7 +106,7 @@ decc_feat_t decc_feat_array[] = {
};
-char **copy_argv(int *argc, argv_t argv)
+char **copy_argv(int *argc, char *argv[])
{
/*-
* The note below is for historical purpose. On VMS now we always