N version of the target file can be created. Attachments are created by setting the "attach" argument of
TRUE. Copying from one remote server to another is implemented by retrieving the "from" file into the cache on the system volume.
FS.
Copy:
PROC [from, to:
ROPE, setKeep:
BOOLEAN ←
FALSE, keep:
CARDINAL ← 1, wantedCreatedTime: BasicTime.
GMT ← BasicTime.nullGMT, remoteCheck:
BOOLEAN ←
TRUE, attach:
BOOLEAN ←
FALSE, wDir:
ROPE ←
NIL];
The "to" name cannot contain a version part. The version of the "to" file created is one larger than the existing !H version, unless "to" is a GName on a server that does not support version numbers, in which case an existing global file will be overwritten.
Case 1: "to" is a GName and "attach" is FALSE — FS does an FS.Open[from, read, wantedCreatedTime, remoteCheck, wdir] and stores the contents and properties of the opened file directly in the new "to" file on the remote server.
Case 2: "to" is an LName and "attach" is FALSE — FS does an FS.Open[from, read, wantedCreatedTime, remoteCheck, wDir] to generate a "from" open file, and FS.Create[to, setKeep, keep, wDir] to generate a "to" OpenFile. The contents and properties are copied from the "from" OpenFile to the "to" OpenFile, and both are closed. (In the case of copying from an uncached global file, the global file is not added to the cache. The only pages allocated on the local volume are those needed to hold the target local file.)
Case 3: "to" is a GName, "attach" is TRUE, and "from" is a LName — Things proceed as in case 1. Once the transfer is completed, the LName is attached to the GName. Case 3 is used by "SModel".
Case 4: "to" is an LName, "attach" is TRUE, and from" is a GName — Like case 2 except that instead of an actual transfer of contents and properties, the LName is attached to the GName / created-time. If no "wantedCreatedTime" is specified, or if "remoteCheck" is TRUE, then FS.FileInfo[to, wantedCreatedTime, TRUE] is performed first to determine/check the version number and created-time for the GName and any resulting FS.Error is passed on to the client. When "remoteCheck" is FALSE (but a wantedCreatedTime" is specified) then the attachment is made to the "from" and "wantedCreatedTime" arguments without checking either the remote server or the cache. Case 4 is used by "BringOver".
Case 5: both "from" and "to" are LNames, or both are GNames, and "attach is "TRUE" — FS proceeds as though "attach" were FALSE (see cases 1 and 2 above).
Client errors: $zeroKeep
User errors: $nonCedarVolume, $unknownServer, $unknownVolume, $unknownFile, $unknownCreatedTime, $illegalName, $patternNotAllowed, $versionSpecified (on "to" name)