1
#if defined( __VMS) && !defined( OPENSSL_NO_DECC_INIT) && \
2
defined( __DECC) && !defined( __VAX) && (__CRTL_VER >= 70301000)
3
# define USE_DECC_INIT 1
11
*----------------------------------------------------------------------
15
* On non-VAX systems, uses LIB$INITIALIZE to set a collection of C
16
* RTL features without using the DECC$* logical name method.
18
*----------------------------------------------------------------------
27
/* Flag to sense if decc_init() was called. */
29
int decc_init_done = -1;
31
/* Structure to hold a DECC$* feature name and its desired value. */
39
* Array of DECC$* feature names and their desired values. Note:
40
* DECC$ARGV_PARSE_STYLE is the urgent one.
43
decc_feat_t decc_feat_array[] = {
44
/* Preserve command-line case with SET PROCESS/PARSE_STYLE=EXTENDED */
45
{"DECC$ARGV_PARSE_STYLE", 1},
47
/* Preserve case for file names on ODS5 disks. */
48
{"DECC$EFS_CASE_PRESERVE", 1},
51
* Enable multiple dots (and most characters) in ODS5 file names, while
52
* preserving VMS-ness of ";version".
54
{"DECC$EFS_CHARSET", 1},
56
/* List terminator. */
60
/* LIB$INITIALIZE initialization function. */
62
static void decc_init(void)
64
char *openssl_debug_decc_init;
73
/* Get debug option. */
74
openssl_debug_decc_init = getenv("OPENSSL_DEBUG_DECC_INIT");
75
if (openssl_debug_decc_init != NULL) {
76
verbose = strtol(openssl_debug_decc_init, NULL, 10);
82
/* Set the global flag to indicate that LIB$INITIALIZE worked. */
85
/* Loop through all items in the decc_feat_array[]. */
87
for (i = 0; decc_feat_array[i].name != NULL; i++) {
88
/* Get the feature index. */
89
feat_index = decc$feature_get_index(decc_feat_array[i].name);
90
if (feat_index >= 0) {
91
/* Valid item. Collect its properties. */
92
feat_value = decc$feature_get_value(feat_index, 1);
93
feat_value_min = decc$feature_get_value(feat_index, 2);
94
feat_value_max = decc$feature_get_value(feat_index, 3);
96
/* Check the validity of our desired value. */
97
if ((decc_feat_array[i].value >= feat_value_min) &&
98
(decc_feat_array[i].value <= feat_value_max)) {
99
/* Valid value. Set it if necessary. */
100
if (feat_value != decc_feat_array[i].value) {
101
sts = decc$feature_set_value(feat_index,
102
1, decc_feat_array[i].value);
105
fprintf(stderr, " %s = %d, sts = %d.\n",
106
decc_feat_array[i].name,
107
decc_feat_array[i].value, sts);
111
/* Invalid DECC feature value. */
113
" INVALID DECC$FEATURE VALUE, %d: %d <= %s <= %d.\n",
115
feat_value_min, decc_feat_array[i].name,
119
/* Invalid DECC feature name. */
121
" UNKNOWN DECC$FEATURE: %s.\n", decc_feat_array[i].name);
126
fprintf(stderr, " DECC_INIT complete.\n");
130
/* Get "decc_init()" into a valid, loaded LIB$INITIALIZE PSECT. */
135
* Establish the LIB$INITIALIZE PSECTs, with proper alignment and other
136
* attributes. Note that "nopic" is significant only on VAX.
138
# pragma extern_model save
140
# if __INITIAL_POINTER_SIZE == 64
141
# define PSECT_ALIGN 3
143
# define PSECT_ALIGN 2
146
# pragma extern_model strict_refdef "LIB$INITIALIZ" PSECT_ALIGN, nopic, nowrt
147
const int spare[8] = { 0 };
149
# pragma extern_model strict_refdef "LIB$INITIALIZE" PSECT_ALIGN, nopic, nowrt
150
void (*const x_decc_init) () = decc_init;
152
# pragma extern_model restore
154
/* Fake reference to ensure loading the LIB$INITIALIZE PSECT. */
156
# pragma extern_model save
158
int LIB$INITIALIZE(void);
160
# pragma extern_model strict_refdef
161
int dmy_lib$initialize = (int)LIB$INITIALIZE;
163
# pragma extern_model restore
167
#else /* def USE_DECC_INIT */
169
/* Dummy code to avoid a %CC-W-EMPTYFILE complaint. */
170
int decc_init_dummy(void);
172
#endif /* def USE_DECC_INIT */