Change 31421 by [EMAIL PROTECTED] on 2007/06/19 12:29:32
Better handling of escapes in filenames when converting between VMS
and Unix syntax.
Affected files ...
... //depot/perl/vms/vms.c#200 edit
Differences ...
==== //depot/perl/vms/vms.c#200 (text) ====
Index: perl/vms/vms.c
--- perl/vms/vms.c#199~31385~ 2007-06-14 20:19:46.000000000 -0700
+++ perl/vms/vms.c 2007-06-19 05:29:32.000000000 -0700
@@ -521,6 +521,16 @@
case ']':
case '%':
case '^':
+ /* Don't escape again if following character is
+ * already something we escape.
+ */
+ if (strchr(".~!#&\'`()[EMAIL PROTECTED],;[]%^=_", *(inspec+1))) {
+ *outspec = *inspec;
+ *output_cnt = 1;
+ return 1;
+ break;
+ }
+ /* But otherwise fall through and escape it. */
case '=':
/* Assume that this is to be escaped */
outspec[0] = '^';
@@ -564,17 +574,26 @@
if (*inspec == '^') {
inspec++;
switch (*inspec) {
+ /* Spaces and non-trailing dots should just be passed through,
+ * but eat the escape character.
+ */
case '.':
- /* Non trailing dots should just be passed through, but eat the
escape */
*outspec = *inspec;
- count++;
+ count += 2;
+ (*output_cnt)++;
break;
case '_': /* space */
*outspec = ' ';
- inspec++;
- count++;
+ count += 2;
(*output_cnt)++;
break;
+ case '^':
+ /* Hmm. Better leave the escape escaped. */
+ outspec[0] = '^';
+ outspec[1] = '^';
+ count += 2;
+ (*output_cnt) += 2;
+ break;
case 'U': /* Unicode - FIX-ME this is wrong. */
inspec++;
count++;
@@ -7559,6 +7578,14 @@
case '#':
case '%':
case '^':
+ /* Don't escape again if following character is
+ * already something we escape.
+ */
+ if (strchr("\"~`!#%^&()=+\'@[]{}:\\|<>_.", *(cp2+1))) {
+ *(cp1++) = *(cp2++);
+ break;
+ }
+ /* But otherwise fall through and escape it. */
case '&':
case '(':
case ')':
End of Patch.