diff options
author | Craig A. Berry <craigberry@mac.com> | 2007-06-19 12:29:32 +0000 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2007-06-19 12:29:32 +0000 |
commit | adc11f0b907360e0200070e6c61df037613107d4 (patch) | |
tree | 8fc401be56511aca539bebf3127ac2254d4d5e7c /vms | |
parent | 28994922d860cd50218c374183da61ac17bca9a8 (diff) | |
download | perl-adc11f0b907360e0200070e6c61df037613107d4.tar.gz |
Better handling of escapes in filenames when converting between VMS
and Unix syntax.
p4raw-id: //depot/perl@31421
Diffstat (limited to 'vms')
-rw-r--r-- | vms/vms.c | 35 |
1 files changed, 31 insertions, 4 deletions
@@ -521,6 +521,16 @@ int utf8_flag; case ']': case '%': case '^': + /* Don't escape again if following character is + * already something we escape. + */ + if (strchr(".~!#&\'`()+@{},;[]%^=_", *(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 @@ int scnt; 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 @@ static char *mp_do_tovmsspec 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 ')': |