Commit 368058d0 authored by Richard Levitte's avatar Richard Levitte
Browse files

Force argv to be an array of long pointers on VMS



Reverts commit 087ca80a

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: default avatarAndy Polyakov <appro@openssl.org>
parent 5902821d
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1763,7 +1763,7 @@ sub vms_info {
    "vms-alpha-p64" => {
    "vms-alpha-p64" => {
        inherit_from     => [ "vms-alpha" ],
        inherit_from     => [ "vms-alpha" ],
        cflags           =>
        cflags           =>
            add("/POINTER_SIZE=64",
            add("/POINTER_SIZE=64=ARGV",
                sub { my @warnings =
                sub { my @warnings =
                          @{vms_info()->{disable_warns_p64}};
                          @{vms_info()->{disable_warns_p64}};
                      @warnings
                      @warnings
@@ -1796,7 +1796,7 @@ sub vms_info {
    "vms-ia64-p64" => {
    "vms-ia64-p64" => {
        inherit_from     => [ "vms-ia64" ],
        inherit_from     => [ "vms-ia64" ],
        cflags           =>
        cflags           =>
            add("/POINTER_SIZE=64",
            add("/POINTER_SIZE=64=ARGV",
                sub { my @warnings =
                sub { my @warnings =
                          @{vms_info()->{disable_warns_p64}};
                          @{vms_info()->{disable_warns_p64}};
                      @warnings
                      @warnings
+3 −2
Original line number Original line Diff line number Diff line
@@ -18,8 +18,9 @@
 An ANSI C compiled is needed among other things.  This means that
 An ANSI C compiled is needed among other things.  This means that
 VAX C is not and will not be supported.
 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
 We have only tested with DEC C (a.k.a HP VMS C / VSI C) and require
 with a different ANSI C compiler may require some work.
 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
 Please avoid using C RTL feature logical names DECC$* when building
 and testing OpenSSL.  Most of all, they can be disruptive when
 and testing OpenSSL.  Most of all, they can be disruptive when
+6 −9
Original line number Original line Diff line number Diff line
@@ -445,15 +445,12 @@ typedef struct args_st {
    char **argv;
    char **argv;
} ARGS;
} ARGS;


#if defined(OPENSSL_SYS_VMS) && defined(__DECC)
/*
# pragma pointer_size save
 * VMS C only for now, implemented in vms_decc_init.c
# pragma pointer_size 32
 * If other C compilers forget to terminate argv with NULL, this function
typedef char **argv_t;
 * can be re-used.
# pragma pointer_size restore
 */
char **copy_argv(int *argc, argv_t argv);
char **copy_argv(int *argc, char *argv[]);
#else
typedef char **argv_t;
#endif




# define PW_MIN_LENGTH 4
# define PW_MIN_LENGTH 4
+7 −10
Original line number Original line Diff line number Diff line
@@ -216,7 +216,6 @@ int main(int argc, char *argv[])
    FUNCTION f, *fp;
    FUNCTION f, *fp;
    LHASH_OF(FUNCTION) *prog = NULL;
    LHASH_OF(FUNCTION) *prog = NULL;
    char **copied_argv = NULL;
    char **copied_argv = NULL;
    char **argv_alias  = NULL;
    char *p, *pname;
    char *p, *pname;
    char buf[1024];
    char buf[1024];
    const char *prompt;
    const char *prompt;
@@ -233,9 +232,7 @@ int main(int argc, char *argv[])
    bio_err = dup_bio_err(FORMAT_TEXT);
    bio_err = dup_bio_err(FORMAT_TEXT);


#if defined(OPENSSL_SYS_VMS) && defined(__DECC)
#if defined(OPENSSL_SYS_VMS) && defined(__DECC)
    copied_argv = argv_alias = copy_argv(&argc, argv);
    copied_argv = argv = copy_argv(&argc, argv);
#else
    argv_alias = argv;
#endif
#endif


    p = getenv("OPENSSL_DEBUG_MEMORY");
    p = getenv("OPENSSL_DEBUG_MEMORY");
@@ -259,22 +256,22 @@ int main(int argc, char *argv[])
        goto end;
        goto end;


    prog = prog_init();
    prog = prog_init();
    pname = opt_progname(argv_alias[0]);
    pname = opt_progname(argv[0]);


    /* first check the program name */
    /* first check the program name */
    f.name = pname;
    f.name = pname;
    fp = lh_FUNCTION_retrieve(prog, &f);
    fp = lh_FUNCTION_retrieve(prog, &f);
    if (fp != NULL) {
    if (fp != NULL) {
        argv_alias[0] = pname;
        argv[0] = pname;
        ret = fp->func(argc, argv_alias);
        ret = fp->func(argc, argv);
        goto end;
        goto end;
    }
    }


    /* If there is stuff on the command line, run with that. */
    /* If there is stuff on the command line, run with that. */
    if (argc != 1) {
    if (argc != 1) {
        argc--;
        argc--;
        argv_alias++;
        argv++;
        ret = do_cmd(prog, argc, argv_alias);
        ret = do_cmd(prog, argc, argv);
        if (ret < 0)
        if (ret < 0)
            ret = 0;
            ret = 0;
        goto end;
        goto end;
+1 −1
Original line number Original line Diff line number Diff line
@@ -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
     * The note below is for historical purpose.  On VMS now we always