Handle "no versions" feature in fileify and tovmsspec.
authorCraig A. Berry <craigberry@mac.com>
Sun, 9 Mar 2014 00:35:49 +0000 (18:35 -0600)
committerCraig A. Berry <craigberry@mac.com>
Mon, 10 Mar 2014 12:15:17 +0000 (07:15 -0500)
This is a follow-up to d5e61aaf9d7051b136, where we stopped
escaping semicolons in tovmsspec when they appeared to be the
beginning of a version specification but always escaped them
otherwise.

It turns out there is yet another CRTL feature logical name
(DECC$FILENAME_UNIX_NO_VERSION) that tells us a Unix-format
specification is not allowed to have a version number, so in
that case, always escape the semicolon since it can't be the
start of a version specification.

Also, don't add the version number when fileifying directory
specs if this "no versions" feature is in effect.

vms/vms.c

index b94d293..324cfa1 100644 (file)
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -6130,9 +6130,11 @@ int_fileify_dirspec(const char *dir, char *buf, int *utf8_fl)
       /* We've picked up everything up to the directory file name.
          Now just add the type and version, and we're set. */
       if ((!decc_efs_case_preserve) && vms_process_case_tolerant)
-          strcat(buf,".dir;1");
+          strcat(buf,".dir");
       else
-          strcat(buf,".DIR;1");
+          strcat(buf,".DIR");
+      if (!decc_filename_unix_no_version)
+          strcat(buf,";1");
       PerlMem_free(trndir);
       PerlMem_free(vmsdir);
       return buf;
@@ -8298,7 +8300,6 @@ static char *int_tovmsspec
   int no_type_seen;
   char * v_spec, * r_spec, * d_spec, * n_spec, * e_spec, * vs_spec;
   int sts, v_len, r_len, d_len, n_len, e_len, vs_len;
-  size_t all_nums;
 
   if (vms_debug_fileify) {
       if (path == NULL)
@@ -8705,12 +8706,17 @@ static char *int_tovmsspec
        break;
     case ';':
         /* If it doesn't look like the beginning of a version number,
+         * or we've been promised there are no version numbers, then
          * escape it.
          */
-       all_nums = strspn(cp2+1, "0123456789");
-       if (all_nums > 5 || *(cp2 + all_nums + 1) != '\0') {
+       if (decc_filename_unix_no_version) {
          *(cp1++) = '^';
        }
+       else {
+         size_t all_nums = strspn(cp2+1, "0123456789");
+         if (all_nums > 5 || *(cp2 + all_nums + 1) != '\0')
+           *(cp1++) = '^';
+       }
        *(cp1++) = *(cp2++);
        break;
     default: