[cs631apue] hw2 questions

Jan Schaumann jschauma at stevens.edu
Fri Sep 23 10:20:24 EDT 2011


afonsec1 <afonsec1 at stevens.edu> wrote:

> 1. I do check for invalid file inputs (symbolic links, source file that  
> doesn't exist, permission rights, null ptr, etc), but do you want error  
> messages... my code just ignore invalid files or directory.

Think about what a good program would do, what the user would expect and
what makes the most sense.

> 2. The source file could be a directory? so the content of source  
> directory is can be copy to another directory?

Specifying a directory as the first argument to your program would be an
error. (Copying a directory hierarchy is more complex than you are
expected to do correctly at this point.)

> 3. If the destination file already exists, do you want to append or  
> truncate it?

Same as above: think about it.

> 4. The first argument is always a regular file?

You cannot control what the user will give as the first argument, so
your program needs to be able to handle all input.  But the purpose of
the tool is to copy a file.

> 5. For the xtra credit one, I did use mmap and memcpy, but I also used  
> lseek and write just to expand the destination mmap, is that okay?

Whatever is necessary to make the program work is fine.

> 6. Are you timing the program's speed?

Execution time is not a primary factor, but if your program has
fundamental algorithmic flaws, then points may be taken off.

-Jan


More information about the cs631apue mailing list