|
VMS Help CRTL, Feature Logical Names, DECC$RENAME_ALLOW_DIR *Conan The Librarian |
Enabling DECC$RENAME_ALLOW_DIR restores the prior OpenVMS
behavior of the rename function by allowing conversion to a
directory specification when the second argument is an ambiguous
file specification passed as a logical name. The ambiguity is
whether the logical name is a UNIX or OpenVMS file specification.
Consider the following example with DECC$RENAME_ALLOW_DIR
enabled:
rename("file.ext", "logical_name")
/*where logical_name = dev:[dir.subdir]*/
/* and :[dir.subdir] exists. */
This results in:
dev:[dir.subdir]file.ext
This example renames a file from one directory into another
directory, which is the same behavior as in legacy versions
of OpenVMS (versions before 7.3-1). Also in this example, if
dev:[dir.subdir] does not exist, rename returns an error.
Disabling DECC$RENAME_ALLOW_DIR provides a more UNIX compliant
conversion of the "logical_name" argument of rename. Consider the
following example with DECC$RENAME_ALLOW_DIR disabled:
rename("file.ext", "logical_name")
/* where logical_name = dev:[dir.subdir] */
This results in:
dev:[dir]subdir.ext
This example renames the file using the subdir part of the
"logical_name" argument as the new filename because on UNIX
systems, renaming a file to a directory is not allowed. So
rename internally converts the "logical_name" to a filename, and
dev:[dir]subdir is the most reasonable conversion it can perform.
This new feature switch has a side effect of causing rename to a
directory to take precedence over rename to a file. Consider this
example:
rename ( "file1.ext", "dir2" ) /* dir2 is not a logical */
With DECC$RENAME_ALLOW_DIR disabled, this example results in
dir2.ext, regardless of whether or not subdirectory [.dir2]
exists.
With DECC$RENAME_ALLOW_DIR enabled, this example results in
dir2.ext only if subdirectory [.dir2] does not exist. If
subdirectory [.dir2] does exist, the result is [.dir2]file1.ext.
NOTE
If DECC$RENAME_NO_INHERIT is enabled, UNIX compliant
behavior is expected, so DECC$RENAME_ALLOW_DIR is ignored,
and renaming a file to a directory is not allowed.
|
|