[cs631apue] Some details related to the HW2

Sadia Akhter sakhter at stevens.edu
Sat Sep 20 22:43:09 EDT 2014


One more question regarding the homework. Suppose we run our program with:

tcp file1 dir/file2

and directory dir does not exist, what is the expected behavior of the program? In my program, I assumed that if any directory in the path does not exist, the program will create the directory and copy inside it. So, my program creates directory dir, creates a file named file2 inside dir and then copies the contents of file1 into file2.

But I just realized that "cp" does not work this way. If dir does not exist, it just prints error message and exits.

Can you please confirm which behavior you want to be implemented in the assignment?

Thanks,
Sadia

On Sep 18, 2014, at 8:42 PM, Jan Schaumann <jschauma at stevens.edu> wrote:

> Sadia Akhter <sakhter at stevens.edu> wrote:
>> So, our program should support copying only regular files, not other
>> types of files (for example, directory, special files, link etc). Is
>> it correct?
> 
> Correct, being able to copy a regular file is a requirement.
> 
> For other types of files, you may error out.  However, your program
> must fail explicitly and gracefully if it encounters a situation it
> can't handle.
> 
> -Jan



More information about the cs631apue mailing list