| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
#if defined(vms) |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
#include "MagickCore/studio.h" |
| 46 |
#include "MagickCore/string_.h" |
| 47 |
#include "MagickCore/memory_.h" |
| 48 |
#include "MagickCore/vms.h" |
| 49 |
|
| 50 |
#if !defined(_AXP_) && (!defined(__VMS_VER) || (__VMS_VER < 70000000)) |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
void closedir(DIR *directory) |
| 74 |
{ |
| 75 |
if (IsEventLogging() != MagickFalse) |
| 76 |
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); |
| 77 |
assert(directory != (DIR *) NULL); |
| 78 |
directory->pattern=DestroyString(directory->pattern); |
| 79 |
directory=DestroyString(directory); |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
DIR *opendir(char *name) |
| 107 |
{ |
| 108 |
DIR |
| 109 |
*directory; |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
directory=(DIR *) AcquireMagickMemory(sizeof(DIR)); |
| 115 |
if (directory == (DIR *) NULL) |
| 116 |
{ |
| 117 |
errno=ENOMEM; |
| 118 |
return((DIR *) NULL); |
| 119 |
} |
| 120 |
if (strcmp(".",name) == 0) |
| 121 |
name=""; |
| 122 |
directory->pattern=(char *) AcquireQuantumMemory(strlen(name)+sizeof("*.*")+ |
| 123 |
1UL,sizeof(*directory->pattern)); |
| 124 |
if (directory->pattern == (char *) NULL) |
| 125 |
{ |
| 126 |
directory=DestroyString(directory); |
| 127 |
errno=ENOMEM; |
| 128 |
return(NULL); |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
(void) FormatLocaleString(directory->pattern,MagickPathExtent,"%s*.*",name); |
| 134 |
directory->context=0; |
| 135 |
directory->pat.dsc$a_pointer=directory->pattern; |
| 136 |
directory->pat.dsc$w_length=strlen(directory->pattern); |
| 137 |
directory->pat.dsc$b_dtype=DSC$K_DTYPE_T; |
| 138 |
directory->pat.dsc$b_class=DSC$K_CLASS_S; |
| 139 |
return(directory); |
| 140 |
} |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
struct dirent *readdir(DIR *directory) |
| 167 |
{ |
| 168 |
char |
| 169 |
buffer[sizeof(directory->entry.d_name)]; |
| 170 |
|
| 171 |
int |
| 172 |
status; |
| 173 |
|
| 174 |
char |
| 175 |
*p; |
| 176 |
|
| 177 |
int |
| 178 |
i; |
| 179 |
|
| 180 |
struct dsc$descriptor_s |
| 181 |
result; |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
result.dsc$a_pointer=buffer; |
| 187 |
result.dsc$w_length=sizeof(buffer)-2; |
| 188 |
result.dsc$b_dtype=DSC$K_DTYPE_T; |
| 189 |
result.dsc$b_class=DSC$K_CLASS_S; |
| 190 |
status=lib$find_file(&directory->pat,&result,&directory->context); |
| 191 |
if ((status == RMS$_NMF) || (directory->context == 0L)) |
| 192 |
return((struct dirent *) NULL); |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
buffer[sizeof(buffer)-1]='\0'; |
| 197 |
for (p=buffer; *p; p++) |
| 198 |
if (isupper((int) ((unsigned char) *p))) |
| 199 |
*p=LocaleToLowercase(*p); |
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
p=buffer; |
| 204 |
while (isspace((int) ((unsigned char) *p)) == 0) |
| 205 |
p++; |
| 206 |
*p='\0'; |
| 207 |
p=strchr(buffer,']'); |
| 208 |
if (p) |
| 209 |
(void) CopyMagickString(directory->entry.d_name,p+1,MagickPathExtent); |
| 210 |
else |
| 211 |
(void) CopyMagickString(directory->entry.d_name,buffer,MagickPathExtent); |
| 212 |
directory->entry.d_namlen=strlen(directory->entry.d_name); |
| 213 |
return(&directory->entry); |
| 214 |
} |
| 215 |
#endif |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
MagickExport MagickBooleanType VMSIsMagickConflict(const char *magick) |
| 244 |
{ |
| 245 |
ile3 |
| 246 |
item_list[2]; |
| 247 |
|
| 248 |
int |
| 249 |
device_class = 0, |
| 250 |
status; |
| 251 |
|
| 252 |
struct dsc$descriptor_s |
| 253 |
device; |
| 254 |
|
| 255 |
assert(magick != (char *) NULL); |
| 256 |
device.dsc$w_length=strlen(magick); |
| 257 |
device.dsc$a_pointer=(char *) magick; |
| 258 |
device.dsc$b_class=DSC$K_CLASS_S; |
| 259 |
device.dsc$b_dtype=DSC$K_DTYPE_T; |
| 260 |
item_list[0].ile3$w_length=sizeof(device_class); |
| 261 |
item_list[0].ile3$w_code=DVI$_DEVCLASS; |
| 262 |
item_list[0].ile3$ps_bufaddr=&device_class; |
| 263 |
item_list[0].ile3$ps_retlen_addr=NULL; |
| 264 |
(void) memset(&item_list[1],0,sizeof(item_list[1])); |
| 265 |
status=sys$getdviw(0,0,&device,&item_list,0,0,0,0); |
| 266 |
if ((status == SS$_NONLOCAL) || |
| 267 |
((status & 0x01) && (device_class & (DC$_DISK | DC$_TAPE)))) |
| 268 |
return(MagickTrue); |
| 269 |
return(MagickFalse); |
| 270 |
} |
| 271 |
#endif |