summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/LPdir_vms.c
diff options
context:
space:
mode:
authordjm <>2011-11-03 02:32:21 +0000
committerdjm <>2011-11-03 02:32:21 +0000
commit154527e9cde3004ed29ea1316880670ec73dcafa (patch)
tree039bc1f1e47623f1bbe9d4e2d08ce2b38304c288 /src/lib/libcrypto/LPdir_vms.c
parent9a7b3d0a0771900cbef9da83983d105d060ad02e (diff)
parent074782d395f8a140cd5120b87574dcd928bacd24 (diff)
downloadopenbsd-154527e9cde3004ed29ea1316880670ec73dcafa.tar.gz
openbsd-154527e9cde3004ed29ea1316880670ec73dcafa.tar.bz2
openbsd-154527e9cde3004ed29ea1316880670ec73dcafa.zip
This commit was generated by cvs2git to track changes on a CVS vendor
branch.
Diffstat (limited to 'src/lib/libcrypto/LPdir_vms.c')
-rw-r--r--src/lib/libcrypto/LPdir_vms.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/src/lib/libcrypto/LPdir_vms.c b/src/lib/libcrypto/LPdir_vms.c
index 85b427a623..7613bd254e 100644
--- a/src/lib/libcrypto/LPdir_vms.c
+++ b/src/lib/libcrypto/LPdir_vms.c
@@ -40,22 +40,18 @@
40#ifndef LPDIR_H 40#ifndef LPDIR_H
41#include "LPdir.h" 41#include "LPdir.h"
42#endif 42#endif
43#include "vms_rms.h"
43 44
44/* Because some compiler options hide this macor */ 45/* Some compiler options hide EVMSERR. */
45#ifndef EVMSERR 46#ifndef EVMSERR
46#define EVMSERR 65535 /* error for non-translatable VMS errors */ 47# define EVMSERR 65535 /* error for non-translatable VMS errors */
47#endif 48#endif
48 49
49struct LP_dir_context_st 50struct LP_dir_context_st
50{ 51{
51 unsigned long VMS_context; 52 unsigned long VMS_context;
52#ifdef NAML$C_MAXRSS 53 char filespec[ NAMX_MAXRSS+ 1];
53 char filespec[NAML$C_MAXRSS+1]; 54 char result[ NAMX_MAXRSS+ 1];
54 char result[NAML$C_MAXRSS+1];
55#else
56 char filespec[256];
57 char result[256];
58#endif
59 struct dsc$descriptor_d filespec_dsc; 55 struct dsc$descriptor_d filespec_dsc;
60 struct dsc$descriptor_d result_dsc; 56 struct dsc$descriptor_d result_dsc;
61}; 57};
@@ -66,6 +62,16 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
66 char *p, *r; 62 char *p, *r;
67 size_t l; 63 size_t l;
68 unsigned long flags = 0; 64 unsigned long flags = 0;
65
66/* Arrange 32-bit pointer to (copied) string storage, if needed. */
67#if __INITIAL_POINTER_SIZE == 64
68# pragma pointer_size save
69# pragma pointer_size 32
70 char *ctx_filespec_32p;
71# pragma pointer_size restore
72 char ctx_filespec_32[ NAMX_MAXRSS+ 1];
73#endif /* __INITIAL_POINTER_SIZE == 64 */
74
69#ifdef NAML$C_MAXRSS 75#ifdef NAML$C_MAXRSS
70 flags |= LIB$M_FIL_LONG_NAMES; 76 flags |= LIB$M_FIL_LONG_NAMES;
71#endif 77#endif
@@ -93,13 +99,7 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
93 99
94 filespeclen += 4; /* "*.*;" */ 100 filespeclen += 4; /* "*.*;" */
95 101
96 if (filespeclen > 102 if (filespeclen > NAMX_MAXRSS)
97#ifdef NAML$C_MAXRSS
98 NAML$C_MAXRSS
99#else
100 255
101#endif
102 )
103 { 103 {
104 errno = ENAMETOOLONG; 104 errno = ENAMETOOLONG;
105 return 0; 105 return 0;
@@ -115,14 +115,21 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
115 115
116 strcpy((*ctx)->filespec,directory); 116 strcpy((*ctx)->filespec,directory);
117 strcat((*ctx)->filespec,"*.*;"); 117 strcat((*ctx)->filespec,"*.*;");
118
119/* Arrange 32-bit pointer to (copied) string storage, if needed. */
120#if __INITIAL_POINTER_SIZE == 64
121# define CTX_FILESPEC ctx_filespec_32p
122 /* Copy the file name to storage with a 32-bit pointer. */
123 ctx_filespec_32p = ctx_filespec_32;
124 strcpy( ctx_filespec_32p, (*ctx)->filespec);
125#else /* __INITIAL_POINTER_SIZE == 64 */
126# define CTX_FILESPEC (*ctx)->filespec
127#endif /* __INITIAL_POINTER_SIZE == 64 [else] */
128
118 (*ctx)->filespec_dsc.dsc$w_length = filespeclen; 129 (*ctx)->filespec_dsc.dsc$w_length = filespeclen;
119 (*ctx)->filespec_dsc.dsc$b_dtype = DSC$K_DTYPE_T; 130 (*ctx)->filespec_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
120 (*ctx)->filespec_dsc.dsc$b_class = DSC$K_CLASS_S; 131 (*ctx)->filespec_dsc.dsc$b_class = DSC$K_CLASS_S;
121 (*ctx)->filespec_dsc.dsc$a_pointer = (*ctx)->filespec; 132 (*ctx)->filespec_dsc.dsc$a_pointer = CTX_FILESPEC;
122 (*ctx)->result_dsc.dsc$w_length = 0;
123 (*ctx)->result_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
124 (*ctx)->result_dsc.dsc$b_class = DSC$K_CLASS_D;
125 (*ctx)->result_dsc.dsc$a_pointer = 0;
126 } 133 }
127 134
128 (*ctx)->result_dsc.dsc$w_length = 0; 135 (*ctx)->result_dsc.dsc$w_length = 0;