00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include <stdio.h>
00037 #include <string.h>
00038
00039
00040 #include <descrip.h>
00041 #include <lnmdef.h>
00042 #include <stsdef.h>
00043
00044 #pragma member_alignment save
00045 #pragma nomember_alignment longword
00046 #pragma message save
00047 #pragma message disable misalgndmem
00048 struct itmlst_3 {
00049 unsigned short int buflen;
00050 unsigned short int itmcode;
00051 void *bufadr;
00052 unsigned short int *retlen;
00053 };
00054 #pragma message restore
00055 #pragma member_alignment restore
00056
00057 #ifdef __VAX
00058 #define ENABLE "ENABLE"
00059 #define DISABLE "DISABLE"
00060 #else
00061
00062 #define ENABLE TRUE
00063 #define DISABLE 0
00064 int decc$feature_get_index (const char *name);
00065 int decc$feature_set_value (int index, int mode, int value);
00066 #endif
00067
00068 int SYS$TRNLNM(
00069 const unsigned long * attr,
00070 const struct dsc$descriptor_s * table_dsc,
00071 struct dsc$descriptor_s * name_dsc,
00072 const unsigned char * acmode,
00073 const struct itmlst_3 * item_list);
00074 int SYS$CRELNM(
00075 const unsigned long * attr,
00076 const struct dsc$descriptor_s * table_dsc,
00077 const struct dsc$descriptor_s * name_dsc,
00078 const unsigned char * acmode,
00079 const struct itmlst_3 * item_list);
00080
00081
00082
00083 static int sys_trnlnm
00084 (const char * logname,
00085 char * value,
00086 int value_len)
00087 {
00088 const $DESCRIPTOR(table_dsc, "LNM$FILE_DEV");
00089 const unsigned long attr = LNM$M_CASE_BLIND;
00090 struct dsc$descriptor_s name_dsc;
00091 int status;
00092 unsigned short result;
00093 struct itmlst_3 itlst[2];
00094
00095 itlst[0].buflen = value_len;
00096 itlst[0].itmcode = LNM$_STRING;
00097 itlst[0].bufadr = value;
00098 itlst[0].retlen = &result;
00099
00100 itlst[1].buflen = 0;
00101 itlst[1].itmcode = 0;
00102
00103 name_dsc.dsc$w_length = strlen(logname);
00104 name_dsc.dsc$a_pointer = (char *)logname;
00105 name_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
00106 name_dsc.dsc$b_class = DSC$K_CLASS_S;
00107
00108 status = SYS$TRNLNM(&attr, &table_dsc, &name_dsc, 0, itlst);
00109
00110 if ($VMS_STATUS_SUCCESS(status)) {
00111
00112
00113
00114 value[result] = '\0';
00115 }
00116
00117 return status;
00118 }
00119
00120
00121 static int sys_crelnm
00122 (const char * logname,
00123 const char * value)
00124 {
00125 int ret_val;
00126 const char * proc_table = "LNM$PROCESS_TABLE";
00127 struct dsc$descriptor_s proc_table_dsc;
00128 struct dsc$descriptor_s logname_dsc;
00129 struct itmlst_3 item_list[2];
00130
00131 proc_table_dsc.dsc$a_pointer = (char *) proc_table;
00132 proc_table_dsc.dsc$w_length = strlen(proc_table);
00133 proc_table_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
00134 proc_table_dsc.dsc$b_class = DSC$K_CLASS_S;
00135
00136 logname_dsc.dsc$a_pointer = (char *) logname;
00137 logname_dsc.dsc$w_length = strlen(logname);
00138 logname_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
00139 logname_dsc.dsc$b_class = DSC$K_CLASS_S;
00140
00141 item_list[0].buflen = strlen(value);
00142 item_list[0].itmcode = LNM$_STRING;
00143 item_list[0].bufadr = (char *)value;
00144 item_list[0].retlen = NULL;
00145
00146 item_list[1].buflen = 0;
00147 item_list[1].itmcode = 0;
00148
00149 ret_val = SYS$CRELNM(NULL, &proc_table_dsc, &logname_dsc, NULL, item_list);
00150
00151 return ret_val;
00152 }
00153
00154
00155
00156
00157
00158
00159
00160 #ifdef __VAX
00161 static void set_feature_default(const char *name, const char *value)
00162 {
00163 sys_crelnm(name, value);
00164 }
00165 #else
00166 static void set_feature_default(const char *name, int value)
00167 {
00168 int index;
00169
00170 index = decc$feature_get_index(name);
00171
00172 if (index > 0)
00173 decc$feature_set_value (index, 0, value);
00174 }
00175 #endif
00176
00177 static void set_features(void)
00178 {
00179 int status;
00180 char unix_shell_name[255];
00181 int use_unix_settings = 1;
00182
00183 status = sys_trnlnm("GNV$UNIX_SHELL",
00184 unix_shell_name, sizeof unix_shell_name -1);
00185 if (!$VMS_STATUS_SUCCESS(status)) {
00186 unix_shell_name[0] = 0;
00187 use_unix_settings = 0;
00188 }
00189
00190
00191 set_feature_default("DECC$ACL_ACCESS_CHECK", ENABLE);
00192
00193
00194 set_feature_default ("DECC$ARGV_PARSE_STYLE" , ENABLE);
00195
00196
00197
00198
00199
00200 set_feature_default("DECC$DISABLE_POSIX_ROOT", DISABLE);
00201
00202
00203
00204 set_feature_default ("DECC$EFS_CHARSET", ENABLE);
00205 set_feature_default ("DECC$EFS_CASE_PRESERVE", ENABLE);
00206
00207
00208 set_feature_default ("DECC$EFS_FILE_TIMESTAMPS", ENABLE);
00209
00210
00211 set_feature_default ("DECC$ENABLE_GETENV_CACHE", ENABLE);
00212
00213
00214 #ifdef __VAX
00215 set_feature_default ("DECC$EXEC_FILEATTR_INHERITANCE", "2");
00216 #else
00217 set_feature_default ("DECC$EXEC_FILEATTR_INHERITANCE", 2);
00218 #endif
00219
00220
00221 set_feature_default ("DECC$READDIR_DROPDOTNOTYPE", ENABLE);
00222
00223
00224
00225 set_feature_default ("DECC$STDIO_CTX_EOL", ENABLE);
00226
00227
00228 set_feature_default ("DECC$RENAME_NO_INHERIT", ENABLE);
00229
00230 if (use_unix_settings) {
00231
00232
00233 set_feature_default ("DECC$ALLOW_REMOVE_OPEN_FILES", ENABLE);
00234
00235
00236 set_feature_default ("DECC$FILENAME_UNIX_ONLY", ENABLE);
00237
00238
00239
00240 set_feature_default ("DECC$FILE_PERMISSION_UNIX", ENABLE);
00241
00242 set_feature_default ("DECC$FILE_SHARING", ENABLE);
00243
00244 set_feature_default ("DECC$FILE_OWNER_UNIX", ENABLE);
00245 set_feature_default ("DECC$POSIX_SEEK_STREAM_FILE", ENABLE);
00246
00247 } else {
00248 set_feature_default("DECC$FILENAME_UNIX_REPORT", ENABLE);
00249 }
00250
00251
00252 set_feature_default ("DECC$GLOB_UNIX_STYLE", ENABLE);
00253
00254
00255
00256 set_feature_default("DECC$FILENAME_UNIX_NO_VERSION", ENABLE);
00257
00258
00259
00260 set_feature_default("DECC$UNIX_PATH_BEFORE_LOGNAME", ENABLE);
00261
00262
00263 set_feature_default("DECC$STRTOL_ERANGE", ENABLE);
00264
00265
00266
00267
00268
00269 }
00270
00271
00272
00273
00274 #pragma nostandard
00275 #pragma extern_model save
00276 #ifdef __VAX
00277 #pragma extern_model strict_refdef "LIB$INITIALIZE" nowrt, long, nopic
00278 #else
00279 #pragma extern_model strict_refdef "LIB$INITIALIZE" nowrt, long
00280 # if __INITIAL_POINTER_SIZE
00281 # pragma __pointer_size __save
00282 # pragma __pointer_size 32
00283 # else
00284 # pragma __required_pointer_size __save
00285 # pragma __required_pointer_size 32
00286 # endif
00287 #endif
00288
00289 void (* const iniarray[])(void) = {set_features, } ;
00290 #ifndef __VAX
00291 # if __INITIAL_POINTER_SIZE
00292 # pragma __pointer_size __restore
00293 # else
00294 # pragma __required_pointer_size __restore
00295 # endif
00296 #endif
00297
00298
00299
00300
00301
00302
00303 int LIB$INITIALIZE(void);
00304 #ifdef __DECC
00305 #pragma extern_model strict_refdef
00306 #endif
00307 int lib_init_ref = (int) LIB$INITIALIZE;
00308 #ifdef __DECC
00309 #pragma extern_model restore
00310 #pragma standard
00311 #endif