/************************************************************************//* more file manipulation *//************************************************************************/
/**COPY-FILE( src-str src-strlen dst-str dst-strlen -- errno|0 )
* like RENAME-FILE, copies the file from src-name to dst-name
* and returns an error-code or null
*/FCode (p4_copy_file)
{
char* src = p4_pocket_filename ((char *) SP[3], SP[2]);
char* dst = p4_pocket_filename ((char *) SP[1], SP[0]);
SP += 3;
*SP = fn_copy (src, dst, LONG_MAX) ? errno : 0;
}
/**MOVE-FILE( src-str src-strlen dst-str dst-strlen -- errno|0 )
* like RENAME-FILE, but also across-volumes
* moves the file from src-name to dst-name and returns an
* error-code or null
*/FCode (p4_move_file)
{
char* src = p4_pocket_filename ((char *) SP[3], SP[2]);
char* dst = p4_pocket_filename ((char *) SP[1], SP[0]);
SP += 3;
*SP = fn_move (src, dst) ? errno : 0;
}
/**FILE-R/W( addr blk f fid -- )
* like FIG-Forth R/W
*/FCode (p4_file_rw)
{
p4_read_write (
(File *) SP[0], /* file to read from */
(char *) SP[3], /* buffer address, 1K */
(p4ucell) SP[2], /* block number */
SP[0]); /* readflag */
SP += 4;
}
/**FILE-THRU( lo hi file-id -- )
* see THRU
*/FCode (p4_file_thru)
{
File *fid = (File *) *SP++;
int hi = *SP++;
int lo = *SP++;
p4_thru (fid, lo, hi);
}