FS_COPY
Copy a specified file or subdirectory to a specified target.
Syntax
FS_COPY(flag, pcdfsi, pcdfsd, pSrc, iSrcCurDirEnd, pDst, iDstCurDirEnd, nameType)
Parameters
- flag
- Is a bit mask controlling copy
- 0x0001 specifies that an existing target file/directory should be replaced
- 0x0002 specifies that a source file will be appended to the destination file .
- All other bits are reserved.
- (See the description of the DosCopy function call in the OS/2 Version 2.0 Control Program Programming Reference.)
- pcdfsi
- Is a pointer to the file-system-independent working directory structure.
- pcdfsd
- Is a pointer to the file-system-dependent working directory structure .
- pSrc
- Is a pointer to the ASCIIZ name of the source file/directory.
- iSrcCurDirEnd
- Is the index of the end of the current directory in pSrc. If = -1, there is no current directory relevant to the source name.
- pDst
- Is a pointer to the ASCIIZ name of the destination file/directory.
- iDstCurDirEnd
- Is the index of the end of the current directory in pDst. If = -1, there is no current directory relevant to the destination name.
- nameType
- Indicates the destination name type.
- NameType == 0x0040 indicates non-8.3 filename format. All other values are reserved.
Returns
Sample
Calling Sequence
int far pascal FS_COPY(flag, pcdfsi, pcdfsd, pSrc, iSrcCurDirEnd, pDst, iDstCurDirEnd, nameType) unsigned short flag; struct cdfsi far * pcdfsi; struct cdfsd far * pcdfsd; char far * pSrc; unsigned short iSrcCurDirEnd; char far * pDst; unsigned short iDstCurDirEnd; unsigned short nameType;
Remarks
The file specified in the source file name should be copied to the target file if possible.
The files specified may not be currently open. File system drivers must assure consistency of file allocation information and directory entries.
The file system driver returns the special CANNOT COPY error if it cannot perform the copy because:
oit does not know how othe source and target are on different volumes oof any other reason for which it would make sense for its caller to perform the copy operation manually.
Returning ERROR_CANNOT_COPY indicates to its caller that it should attempt to perform the copy operation manually. Any other error will be returned directly to the caller of DosCopy. See the description of the DosCopy function call in the OS/2 Version 2.0 Control Program Programming Reference for other error codes that can be returned.
FS_COPY needs to check that certain types of illegal copying operations are not performed. A directory cannot be copied to itself or to one of its subdirectories. This is especially critical in situations where two different fully- qualified pathnames can refer to the same file or directory. For example, if X: is redirected to \\SERVER\SHARE, the X:\PATH and \\ SERVER\SHARE\PATH refer to the same object.
The behavior of FS_COPY should match the behavior of the generic DosCopy routine.
The non-8.3 filename format attribute in the directory entry for the destination name should be set according to the value in nameType.