Amiga-C (17/223)

From:Stephen Illingworth
Date:10 Aug 2001 at 15:22:00
Subject:[amiga-c] Re: How do I copy clone

Hello Jack

On 10-Aug-01, you wrote:

> Hello,
>
> How do I copy a file so that all of its attributes are like the original
> (like the copy clone command but by my own code, not using SystemTagList)?

After the regular copy routine (I assume you've already done this
part), you need to explicitely set the attributes yourself.

You do this by grabbing a copy of the source files info block
(with the Examine() command) and altering just three attributes
of the target file - the comment, the date and the protection
flags. There are three functions in the dos.library that allows
you to do this - SetComment(), SetFileDate() and SetProtection().

A simple function to do this might be written thus,

void
setAttributes (STRPTR target_file, struct FileInfoBlock * source_file_fib)
{
SetProtection (target_file, source_file_fib->fib_Protection);
SetFileDate (target_file, source_file_fib->fib_Date);
SetComment (target_file, source_file_fib->fib_Comment);
}

It may be worth checking for success as not all file systems
support Amiga style protection and comments

You may also consider supporting the multi-user elements, owner
and group IDs, but you'll need an appropriate API for that such
as MUFS.

Regards

Steve

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Small business owners...
Tell us what you think!
http://us.click.yahoo.com/vO1FAB/txzCAA/ySSFAA/dpFolB/TM
---------------------------------------------------------------------~->

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/