diff options
author | John Malmberg <wb8tyw@gmail.com> | 2009-02-22 12:23:29 -0600 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2009-02-22 21:21:16 -0600 |
commit | f785e3a13bdb70150178a2baa433614531998f17 (patch) | |
tree | 271f2255eaf80cbe8a8b7a1c4a9eefe010481858 /vms | |
parent | f05b5874edd1526b5a2b557cc1ffb6ad7552b85d (diff) | |
download | perl-f785e3a13bdb70150178a2baa433614531998f17.tar.gz |
vms.c - Remove .DIR; in UNIX mode.
When doing a readdir() or glob() with DECC$FILENAME_UNIX_REPORT active,
the ".DIR" suffix needs to be removed for directories.
Diffstat (limited to 'vms')
-rw-r--r-- | vms/vms.c | 34 |
1 files changed, 22 insertions, 12 deletions
@@ -10473,18 +10473,14 @@ Perl_readdir(pTHX_ DIR *dd) /* In Unix report mode, remove the ".dir;1" from the name */ /* if it is a real directory. */ if (decc_filename_unix_report || decc_efs_charset) { - if ((e_len == 4) && (vs_len == 2) && (vs_spec[1] == '1')) { - if ((toupper(e_spec[1]) == 'D') && - (toupper(e_spec[2]) == 'I') && - (toupper(e_spec[3]) == 'R')) { - Stat_t statbuf; - int ret_sts; - - ret_sts = stat(buff, &statbuf.crtl_stat); - if ((ret_sts == 0) && S_ISDIR(statbuf.st_mode)) { - e_len = 0; - e_spec[0] = 0; - } + if (is_dir_ext(e_spec, e_len, vs_spec, vs_len)) { + Stat_t statbuf; + int ret_sts; + + ret_sts = flex_lstat(buff, &statbuf); + if ((ret_sts == 0) && S_ISDIR(statbuf.st_mode)) { + e_len = 0; + e_spec[0] = 0; } } } @@ -14370,6 +14366,20 @@ mp_do_vms_realpath(pTHX_ const char *filespec, char *outbuf, int file_len = v_len + r_len + d_len + n_len + e_len; vms_spec[file_len] = 0; + /* Trim off the .DIR if this is a directory */ + if (is_dir_ext(e_spec, e_len, vs_spec, vs_len)) { + if (S_ISDIR(my_mode)) { + e_len = 0; + e_spec[0] = 0; + } + } + + /* Drop NULL extensions on UNIX file specification */ + if ((e_len == 1) && decc_readdir_dropdotnotype) { + e_len = 0; + e_spec[0] = '\0'; + } + /* The result is expected to be in UNIX format */ rslt = int_tounixspec(vms_spec, outbuf, utf8_fl); |