#include <processes.h> /* for vfork() */
#include <unixio.h>
#include <unixlib.h>
-#if __CRTL_VER >= 80200000 && !defined(__VAX)
-#include <dirent.h>
-#endif
#include <file.h> /* it's not <sys/file.h>, so don't use I_SYS_FILE */
#if (defined(__DECC) && defined(__DECC_VER) && __DECC_VER > 20000000) || defined(__DECCXX)
# include <unistd.h> /* DECC has this; gcc doesn't */
# define DONT_MASK_RTL_CALLS
#endif
+#include <namdef.h>
+
+/* Set the maximum filespec size here as it is larger for EFS file
+ * specifications.
+ */
+#ifndef __VAX
+#ifndef VMS_MAXRSS
+#ifdef NAML$C_MAXRSS
+#define VMS_MAXRSS (NAML$C_MAXRSS+1)
+#ifndef VMS_LONGNAME_SUPPORT
+#define VMS_LONGNAME_SUPPORT 1
+#endif /* VMS_LONGNAME_SUPPORT */
+#endif /* NAML$C_MAXRSS */
+#endif /* VMS_MAXRSS */
+#endif
+
+#ifndef VMS_MAXRSS
+#define VMS_MAXRSS (NAM$C_MAXRSS + 1)
+#endif
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN (VMS_MAXRSS - 1)
+#endif
+
+
/* Note that we do, in fact, have this */
#define HAS_GETENV_SV
#define HAS_GETENV_LEN
#define my_getenv Perl_my_getenv
#define tounixspec Perl_tounixspec
#define tounixspec_ts Perl_tounixspec_ts
+#define tounixspec_utf8 Perl_tounixspec_utf8
+#define tounixspec_utf8_ts Perl_tounixspec_utf8_ts
#define tovmsspec Perl_tovmsspec
#define tovmsspec_ts Perl_tovmsspec_ts
+#define tovmsspec_utf8 Perl_tovmsspec_utf8
+#define tovmsspec_utf8_ts Perl_tovmsspec_utf8_ts
#define tounixpath Perl_tounixpath
#define tounixpath_ts Perl_tounixpath_ts
-#define tovmspath Perl_tovmspath
+#define tounixpath_utf8 Perl_tounixpath_utf8
+#define tounixpath_utf8_ts Perl_tounixpath_utf8_ts
+#define tovmspath Perl_tovmspath
#define tovmspath_ts Perl_tovmspath_ts
+#define tovmspath_utf8 Perl_tovmspath_utf8
+#define tovmspath_utf8_ts Perl_tovmspath_utf8_ts
#define do_rmdir Perl_do_rmdir
#define fileify_dirspec Perl_fileify_dirspec
#define fileify_dirspec_ts Perl_fileify_dirspec_ts
+#define fileify_dirspec_utf8 Perl_fileify_dirspec_utf8
+#define fileify_dirspec_utf8_ts Perl_fileify_dirspec_utf8_ts
#define pathify_dirspec Perl_pathify_dirspec
#define pathify_dirspec_ts Perl_pathify_dirspec_ts
+#define pathify_dirspec_utf8 Perl_pathify_dirspec_utf8
+#define pathify_dirspec_utf8_ts Perl_pathify_dirspec_utf8_ts
#define trim_unixpath Perl_trim_unixpath
-#ifndef DONT_MASK_RTL_CALLS
#define opendir Perl_opendir
-#endif
#define rmscopy Perl_rmscopy
#define my_mkdir Perl_my_mkdir
#define vms_do_aexec Perl_vms_do_aexec
#define my_utime Perl_my_utime
#define my_chdir Perl_my_chdir
#define do_aspawn Perl_do_aspawn
-#ifndef DONT_MASK_RTL_CALLS
#define seekdir Perl_seekdir
-#endif
#define my_gmtime Perl_my_gmtime
#define my_localtime Perl_my_localtime
#define my_time Perl_my_time
#define my_getenv_len(a,b,c) Perl_my_getenv_len(aTHX_ a,b,c)
#define vmssetenv(a,b,c) Perl_vmssetenv(aTHX_ a,b,c)
#define my_trnlnm(a,b,c) Perl_my_trnlnm(aTHX_ a,b,c)
+#define fileify_dirspec(a,b) Perl_fileify_dirspec(aTHX_ a,b)
+#define fileify_dirspec_ts(a,b) Perl_fileify_dirspec_ts(aTHX_ a,b)
#define my_setenv(a,b) Perl_my_setenv(aTHX_ a,b)
#define my_getenv(a,b) Perl_my_getenv(aTHX_ a,b)
-#define tounixspec(a,b) Perl_tounixspec(aTHX_ a,b)
-#define tounixspec_ts(a,b) Perl_tounixspec_ts(aTHX_ a,b)
-#define tovmsspec(a,b) Perl_tovmsspec(aTHX_ a,b)
-#define tovmsspec_t(a,b) Perl_tovmsspec_ts(aTHX_ a,b)
-#define tounixpath(a,b) Perl_tounixpath(aTHX_ a,b)
-#define tounixpath_ts(a,b) Perl_tounixpath_ts(aTHX_ a,b)
-#define tovmspath(a,b) Perl_tovmspath(aTHX_ a,b)
-#define tovmspath_ts(a,b) Perl_tovmspath_ts(aTHX_ a,b)
+#define tounixspec(a,b) Perl_tounixspec_utf8(aTHX_ a,b,NULL)
+#define tounixspec_ts(a,b) Perl_tounixspec_utf8_ts(aTHX_ a,b,NULL)
+#define tounixspec_utf8(a,b,c) Perl_tounixspec_utf8(aTHX_ a,b,c)
+#define tounixspec_utf8_ts(a,b,c) Perl_tounixspec_utf8_ts(aTHX_ a,b,c)
+#define tovmsspec(a,b) Perl_tovmsspec_utf8(aTHX_ a,b,NULL)
+#define tovmsspec_ts(a,b) Perl_tovmsspec_utf8_ts(aTHX_ a,b)
+#define tovmsspec_utf8(a,b,c) Perl_tovmsspec_utf8(aTHX_ a,b,c)
+#define tovmsspec_utf8_ts(a,b,c) Perl_tovmsspec_utf8_ts(aTHX_ a,b,c)
+#define tounixpath(a,b) Perl_tounixpath_utf8(aTHX_ a,b,NULL)
+#define tounixpath_ts(a,b) Perl_tounixpath_utf8_ts(aTHX_ a,b,NULL)
+#define tounixpath_utf8(a,b,c) Perl_tounixpath_utf8(aTHX_ a,b,c)
+#define tounixpath_utf8_ts(a,b,c) Perl_tounixpath_utf8_ts(aTHX_ a,b,c)
+#define tovmspath(a,b) Perl_tovmspath_utf8(aTHX_ a,b,NULL)
+#define tovmspath_ts(a,b) Perl_tovmspath_utf8_ts(aTHX_ a,b,NULL)
+#define tovmspath_utf8(a,b,c) Perl_tovmspath_utf8(aTHX_ a,b,c)
+#define tovmspath_utf8_ts(a,b,c) Perl_tovmspath_utf8_ts(aTHX_ a,b,c)
#define do_rmdir(a) Perl_do_rmdir(aTHX_ a)
#define fileify_dirspec(a,b) Perl_fileify_dirspec(aTHX_ a,b)
#define fileify_dirspec_ts(a,b) Perl_fileify_dirspec_ts(aTHX_ a,b)
+#define fileify_dirspec_utf8(a,b,c) Perl_fileify_dirspec(aTHX_ a,b,utf8)
+#define fileify_dirspec_utf8_ts(a,b,c) Perl_fileify_dirspec_ts(aTHX_ a,b,utf8)
#define pathify_dirspec Perl_pathify_dirspec
#define pathify_dirspec_ts Perl_pathify_dirspec_ts
-#define rmsexpand(a,b,c,d) Perl_rmsexpand(aTHX_ a,b,c,d)
-#define rmsexpand_ts(a,b,c,d) Perl_rmsexpand_ts(aTHX_ a,b,c,d)
+#define pathify_dirspec_utf8 Perl_pathify_dirspec_utf8
+#define pathify_dirspec_utf8_ts Perl_pathify_dirspec_utf8_ts
+#define rmsexpand(a,b,c,d) Perl_rmsexpand_utf8(aTHX_ a,b,c,d,NULL,NULL)
+#define rmsexpand_ts(a,b,c,d) Perl_rmsexpand_utf8_ts(aTHX_ a,b,c,d,NULL,NULL)
+#define rmsexpand_utf8(a,b,c,d,e,f) Perl_rmsexpand_utf8(aTHX_ a,b,c,d,e,f)
+#define rmsexpand_utf8_ts(a,b,c,d,e,f) Perl_rmsexpand_utf8_ts(aTHX_ a,b,c,d,e,f)
#define trim_unixpath(a,b,c) Perl_trim_unixpath(aTHX_ a,b,c)
-#ifndef DONT_MASK_RTL_CALLS
#define opendir(a) Perl_opendir(aTHX_ a)
-#endif
#define rmscopy(a,b,c) Perl_rmscopy(aTHX_ a,b,c)
#define my_mkdir(a,b) Perl_my_mkdir(aTHX_ a,b)
#define vms_do_aexec(a,b,c) Perl_vms_do_aexec(aTHX_ a,b,c)
#define my_utime(a,b) Perl_my_utime(aTHX_ a,b)
#define my_chdir(a) Perl_my_chdir(aTHX_ a)
#define do_aspawn(a,b,c) Perl_do_aspawn(aTHX_ a,b,c)
-#ifndef DONT_MASK_RTL_CALLS
#define seekdir(a,b) Perl_seekdir(aTHX_ a,b)
-#endif
#define my_gmtime(a) Perl_my_gmtime(aTHX_ a)
#define my_localtime(a) Perl_my_localtime(aTHX_ a)
#define my_time(a) Perl_my_time(aTHX_ a)
#define my_getpwnam(a) Perl_my_getpwnam(aTHX_ a)
#define my_getpwuid(a) Perl_my_getpwuid(aTHX_ a)
#define my_flush(a) Perl_my_flush(aTHX_ a)
-#ifndef DONT_MASK_RTL_CALLS
#define readdir(a) Perl_readdir(aTHX_ a)
#define readdir_r(a,b,c) Perl_readdir_r(aTHX_ a,b,c)
#endif
-#endif
#define my_gconvert Perl_my_gconvert
-#ifndef DONT_MASK_RTL_CALLS
#define telldir Perl_telldir
#define closedir Perl_closedir
-#endif
#define vmsreaddirversions Perl_vmsreaddirversions
#define my_sigemptyset Perl_my_sigemptyset
#define my_sigfillset Perl_my_sigfillset
#define my_endpwent() Perl_my_endpwent(aTHX)
#define my_getlogin Perl_my_getlogin
#define init_os_extras Perl_init_os_extras
-#define vms_realpath(a, b) Perl_vms_realpath(aTHX_ a,b)
+#define vms_realpath(a, b, c) Perl_vms_realpath(aTHX_ a,b,c)
#define vms_case_tolerant(a) Perl_vms_case_tolerant(a)
/* Delete if at all possible, changing protections if necessary. */
#else
#define BIT_BUCKET "/dev/null"
#endif
-#define PERL_SYS_INIT(c,v) MALLOC_CHECK_TAINT2(*c,*v) vms_image_init((c),(v)); MALLOC_INIT
-#define PERL_SYS_TERM() OP_REFCNT_TERM; MALLOC_TERM
+#define PERL_SYS_INIT(c,v) MALLOC_CHECK_TAINT2(*c,*v) vms_image_init((c),(v)); PERLIO_INIT; MALLOC_INIT
+#define PERL_SYS_TERM() HINTS_REFCNT_TERM; OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM
#define dXSUB_SYS
#define HAS_KILL
#define HAS_WAIT
# include <signal.h>
#define ABORT() abort()
+#ifdef I_UTIME
+#include <utime.h>
+#else
/* Used with our my_utime() routine in vms.c */
struct utimbuf {
time_t actime;
time_t modtime;
};
+#endif
+#ifndef DONT_MASK_RTL_CALLS
#define utime my_utime
+#endif
/* This is what times() returns, but <times.h> calls it tbuffer_t on VMS
* prior to v7.0. We check the DECC manifest to see whether it's already
* vmsreaddirversions(), and preprocessor stuff on which these depend:
* Written by Rich $alz, <rsalz@bbn.com> in August, 1990.
*
- * Feb 2005 - POSIX filespecs need real opendir() structures.
- * rename to remove conflicts. J. Malmberg (HP OpenVMS)
*/
+/* Flags for the _dirdesc structure */
+#define PERL_VMSDIR_M_VERSIONS 0x02 /* Want VMS versions */
+#define PERL_VMSDIR_M_UNIXSPECS 0x04 /* Want UNIX specifications */
+
+
/* Data structure returned by READDIR(). */
-struct my_dirent {
+struct dirent {
char d_name[256]; /* File name */
-# if defined _XOPEN_SOURCE || !defined _POSIX_C_SOURCE
-#if !_USE_STD_STAT
- /* 3 word array */
- __ino_t d_ino[3]; /* file serial number (vms-style inode) */
- unsigned short fill;
-#else /* quadword */
- __ino_t d_ino;
-#endif
int d_namlen; /* Length of d_name */
int vms_verscount; /* Number of versions */
int vms_versions[20]; /* Version numbers */
/* Handle returned by opendir(), used by the other routines. You
* are not supposed to care what's inside this structure. */
-typedef struct my_dirdesc {
-#if __CRTL_VER >= 80200000 && !defined(__VAX)
- int flags;
- DIR *vms_dirdesc;
-#endif
+typedef struct _dirdesc {
long context;
- int vms_wantversions;
+ int flags;
unsigned long int count;
char *pattern;
- struct my_dirent entry;
+ struct dirent entry;
struct dsc$descriptor_s pat;
void *mutex;
-} MY_DIR;
+} DIR;
-#ifndef DONT_MASK_RTL_CALLS
-#define DIR MY_DIR
-#define dirent my_dirent
#define rewinddir(dirp) seekdir((dirp), 0)
-#endif
/* used for our emulation of getpw* */
struct passwd {
#define st_fab_rfm crtl_stat.st_fab_rfm
#define st_fab_rat crtl_stat.st_fab_rat
#define st_fab_fsz crtl_stat.st_fab_fsz
-#define st_fab_mrs crtl_stat_st_fab_mrs
+#define st_fab_mrs crtl_stat.st_fab_mrs
-#endif /* defined(USE_LARGE_FILES) */
+#ifdef _USE_STD_STAT
+#define VMS_INO_T_COMPARE(__a, __b) (__a != __b)
+#define VMS_INO_T_COPY(__a, __b) __a = __b
+#else
+#define VMS_INO_T_COMPARE(__a, __b) memcmp(&__a, &__b, 6)
+#define VMS_INO_T_COPY(__a, __b) memcpy(&__a, &__b, 6)
+#endif
#if defined(__DECC) || defined(__DECCXX)
# pragma __member_alignment __restore
/* prototype section start marker; `typedef' passes through cpp */
typedef char __VMS_PROTOTYPES__;
int Perl_vmstrnenv (const char *, char *, unsigned long int, struct dsc$descriptor_s **, unsigned long int);
-char * Perl_vms_realpath (pTHX_ const char *, char *);
+char * Perl_vms_realpath (pTHX_ const char *, char *, int *);
#if !defined(PERL_IMPLICIT_CONTEXT)
int Perl_vms_case_tolerant(void);
char * Perl_my_getenv (const char *, bool);
int Perl_my_trnlnm (const char *, char *, unsigned long int);
char * Perl_tounixspec (const char *, char *);
char * Perl_tounixspec_ts (const char *, char *);
+char * Perl_tounixspec_utf8 (const char *, char *, int *);
+char * Perl_tounixspec_utf8_ts (const char *, char *, int *);
char * Perl_tovmsspec (const char *, char *);
char * Perl_tovmsspec_ts (const char *, char *);
+char * Perl_tovmsspec_utf8 (const char *, char *, int *);
+char * Perl_tovmsspec_utf8_ts (const char *, char *, int *);
char * Perl_tounixpath (const char *, char *);
char * Perl_tounixpath_ts (const char *, char *);
+char * Perl_tounixpath_utf8 (const char *, char *, int *);
+char * Perl_tounixpath_utf8_ts (const char *, char *, int *);
char * Perl_tovmspath (const char *, char *);
char * Perl_tovmspath_ts (const char *, char *);
+char * Perl_tovmspath_utf8 (const char *, char *, int *);
+char * Perl_tovmspath_utf8_ts (const char *, char *, int *);
int Perl_do_rmdir (const char *);
char * Perl_fileify_dirspec (const char *, char *);
char * Perl_fileify_dirspec_ts (const char *, char *);
+char * Perl_fileify_dirspec_utf8 (const char *, char *, int *);
+char * Perl_fileify_dirspec_utf8_ts (const char *, char *, int *);
char * Perl_pathify_dirspec (const char *, char *);
char * Perl_pathify_dirspec_ts (const char *, char *);
+char * Perl_pathify_dirspec_utf8 (const char *, char *, int *);
+char * Perl_pathify_dirspec_utf8_ts (const char *, char *, int *);
char * Perl_rmsexpand (const char *, char *, const char *, unsigned);
char * Perl_rmsexpand_ts (const char *, char *, const char *, unsigned);
+char * Perl_rmsexpand_utf8 (const char *, char *, const char *, unsigned, int *, int *);
+char * Perl_rmsexpand_utf8_ts (const char *, char *, const char *, unsigned, int *, int *);
int Perl_trim_unixpath (char *, const char*, int);
-MY_DIR * Perl_opendir (const char *);
+DIR * Perl_opendir (const char *);
int Perl_rmscopy (const char *, const char *, int);
int Perl_my_mkdir (const char *, Mode_t);
bool Perl_vms_do_aexec (SV *, SV **, SV **);
int Perl_my_trnlnm (pTHX_ const char *, char *, unsigned long int);
char * Perl_tounixspec (pTHX_ const char *, char *);
char * Perl_tounixspec_ts (pTHX_ const char *, char *);
+char * Perl_tounixspec_utf8 (pTHX_ const char *, char *, int *);
+char * Perl_tounixspec_utf8_ts (pTHX_ const char *, char *, int *);
char * Perl_tovmsspec (pTHX_ const char *, char *);
char * Perl_tovmsspec_ts (pTHX_ const char *, char *);
+char * Perl_tovmsspec_utf8 (pTHX_ const char *, char *, int *);
+char * Perl_tovmsspec_utf8_ts (pTHX_ const char *, char *, int *);
char * Perl_tounixpath (pTHX_ const char *, char *);
char * Perl_tounixpath_ts (pTHX_ const char *, char *);
+char * Perl_tounixpath_utf8 (pTHX_ const char *, char *, int *);
+char * Perl_tounixpath_utf8_ts (pTHX_ const char *, char *, int *);
char * Perl_tovmspath (pTHX_ const char *, char *);
char * Perl_tovmspath_ts (pTHX_ const char *, char *);
+char * Perl_tovmspath_utf8 (pTHX_ const char *, char *, int *);
+char * Perl_tovmspath_utf8_ts (pTHX_ const char *, char *, int *);
int Perl_do_rmdir (pTHX_ const char *);
char * Perl_fileify_dirspec (pTHX_ const char *, char *);
char * Perl_fileify_dirspec_ts (pTHX_ const char *, char *);
+char * Perl_fileify_dirspec_utf8 (pTHX_ const char *, char *, int *);
+char * Perl_fileify_dirspec_utf8_ts (pTHX_ const char *, char *, int *);
char * Perl_pathify_dirspec (pTHX_ const char *, char *);
char * Perl_pathify_dirspec_ts (pTHX_ const char *, char *);
+char * Perl_pathify_dirspec_utf8 (pTHX_ const char *, char *, int *);
+char * Perl_pathify_dirspec_utf8_ts (pTHX_ const char *, char *, int *);
char * Perl_rmsexpand (pTHX_ const char *, char *, const char *, unsigned);
char * Perl_rmsexpand_ts (pTHX_ const char *, char *, const char *, unsigned);
+char * Perl_rmsexpand_utf8 (pTHX_ const char *, char *, const char *, unsigned, int *, int *);
+char * Perl_rmsexpand_utf8_ts (pTHX_ const char *, char *, const char *, unsigned, int *, int *);
int Perl_trim_unixpath (pTHX_ char *, const char*, int);
-MY_DIR * Perl_opendir (pTHX_ const char *);
+DIR * Perl_opendir (pTHX_ const char *);
int Perl_rmscopy (pTHX_ const char *, const char *, int);
int Perl_my_mkdir (pTHX_ const char *, Mode_t);
bool Perl_vms_do_aexec (pTHX_ SV *, SV **, SV **);
#endif
int Perl_my_utime (pTHX_ const char *, const struct utimbuf *);
void Perl_vms_image_init (int *, char ***);
-struct my_dirent * Perl_readdir (pTHX_ MY_DIR *);
-int Perl_readdir_r(pTHX_ MY_DIR *, struct my_dirent *, struct my_dirent **);
-long Perl_telldir (MY_DIR *);
-void Perl_seekdir (pTHX_ MY_DIR *, long);
-void Perl_closedir (MY_DIR *);
-void vmsreaddirversions (MY_DIR *, int);
+struct dirent * Perl_readdir (pTHX_ DIR *);
+int Perl_readdir_r(pTHX_ DIR *, struct dirent *, struct dirent **);
+long Perl_telldir (DIR *);
+void Perl_seekdir (pTHX_ DIR *, long);
+void Perl_closedir (DIR *);
+void vmsreaddirversions (DIR *, int);
struct tm * Perl_my_gmtime (pTHX_ const time_t *);
struct tm * Perl_my_localtime (pTHX_ const time_t *);
time_t Perl_my_time (pTHX_ time_t *);
/* RMSEXPAND options */
#define PERL_RMSEXPAND_M_VMS 0x02 /* Force output to VMS format */
#define PERL_RMSEXPAND_M_LONG 0x04 /* Expand to long name format */
+#define PERL_RMSEXPAND_M_VMS_IN 0x08 /* Assume input is VMS already */
#define PERL_RMSEXPAND_M_SYMLINK 0x20 /* Use symbolic link, not target */
#endif /* __vmsish_h_included */