From: Craig A. Berry Date: Thu, 30 Oct 2008 18:17:04 +0000 (+0000) Subject: Try to demangle the mess created by 34667 (the "resubmittal" was actually X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=643f470b35382516fe3dbc50a5ea42d5018d5205;p=p5sagit%2Fp5-mst-13.2.git Try to demangle the mess created by 34667 (the "resubmittal" was actually not at all like the original patch I tested). p4raw-id: //depot/perl@34668 --- diff --git a/vms/vms.c b/vms/vms.c index bcfae2c..996d4d0 100644 --- a/vms/vms.c +++ b/vms/vms.c @@ -13243,66 +13243,66 @@ mp_do_vms_realpath(pTHX_ const char *filespec, char *outbuf, if (haslower) __mystrtolower(rslt); } } -+ } else { -+ -+ /* Now for some hacks to deal with backwards and forward */ -+ /* compatibilty */ -+ if (!decc_efs_charset) { -+ -+ /* 1. ODS-2 mode wants to do a syntax only translation */ -+ rslt = do_rmsexpand(filespec, outbuf, -+ 0, NULL, 0, NULL, utf8_fl); -+ -+ } else { -+ if (decc_filename_unix_report) { -+ char * dir_name; -+ char * vms_dir_name; -+ char * file_name; -+ -+ /* 2. ODS-5 / UNIX report mode should return a failure */ -+ /* if the parent directory also does not exist */ -+ /* Otherwise, get the real path for the parent */ -+ /* and add the child to it. -+ -+ /* basename / dirname only available for VMS 7.0+ */ -+ /* So we may need to implement them as common routines */ -+ -+ Newx(dir_name, VMS_MAXRSS + 1, char); -+ Newx(vms_dir_name, VMS_MAXRSS + 1, char); -+ dir_name[0] = '\0'; -+ file_name = NULL; -+ -+ /* First try a VMS parse */ -+ sts = vms_split_path -+ (filespec, -+ &v_spec, -+ &v_len, -+ &r_spec, -+ &r_len, -+ &d_spec, -+ &d_len, -+ &n_spec, -+ &n_len, -+ &e_spec, -+ &e_len, -+ &vs_spec, -+ &vs_len); -+ -+ if (sts == 0) { -+ /* This is VMS */ -+ -+ int dir_len = v_len + r_len + d_len + n_len; -+ if (dir_len > 0) { -+ strncpy(dir_name, filespec, dir_len); -+ dir_name[dir_len] = '\0'; -+ file_name = (char *)&filespec[dir_len + 1]; -+ } -+ } else { -+ /* This must be UNIX */ -+ char * tchar; -+ -+ tchar = strrchr(filespec, '/'); -+ + } else { + + /* Now for some hacks to deal with backwards and forward */ + /* compatibilty */ + if (!decc_efs_charset) { + + /* 1. ODS-2 mode wants to do a syntax only translation */ + rslt = do_rmsexpand(filespec, outbuf, + 0, NULL, 0, NULL, utf8_fl); + + } else { + if (decc_filename_unix_report) { + char * dir_name; + char * vms_dir_name; + char * file_name; + + /* 2. ODS-5 / UNIX report mode should return a failure */ + /* if the parent directory also does not exist */ + /* Otherwise, get the real path for the parent */ + /* and add the child to it. + + /* basename / dirname only available for VMS 7.0+ */ + /* So we may need to implement them as common routines */ + + Newx(dir_name, VMS_MAXRSS + 1, char); + Newx(vms_dir_name, VMS_MAXRSS + 1, char); + dir_name[0] = '\0'; + file_name = NULL; + + /* First try a VMS parse */ + sts = vms_split_path + (filespec, + &v_spec, + &v_len, + &r_spec, + &r_len, + &d_spec, + &d_len, + &n_spec, + &n_len, + &e_spec, + &e_len, + &vs_spec, + &vs_len); + + if (sts == 0) { + /* This is VMS */ + + int dir_len = v_len + r_len + d_len + n_len; + if (dir_len > 0) { + strncpy(dir_name, filespec, dir_len); + dir_name[dir_len] = '\0'; + file_name = (char *)&filespec[dir_len + 1]; + } + } else { + /* This must be UNIX */ + char * tchar; + + tchar = strrchr(filespec, '/'); + if (tchar != NULL) { int dir_len = tchar - filespec; strncpy(dir_name, filespec, dir_len); @@ -13337,7 +13337,7 @@ mp_do_vms_realpath(pTHX_ const char *filespec, char *outbuf, Safefree(dir_name); } } - + } Safefree(vms_spec); } return rslt;