[cs631apue] HW5 questions

Rob Hoffmann rhoffman at stevens.edu
Thu Dec 8 15:22:09 EST 2011

Last question, I promise.

In your hw specs you mention "if the patch was already applied, running 
'make' won't do this again etc". After reading through the man pages & 
Google for diff/patch again and again I don't see any way to tell 
whether or not a file has been patched already before running the patch 
command, because there is no original file to do a diff or cmp against. 
Now, if we're allowed to keep backups of the old files upon the initial 
patching (I can't tell from the hw description) then I'll just do that 
and call it a day.

If not, then it is my understanding that patch can tell if a file is 
already patched with the -N flag. But, if it finds that any/all files 
are already patched it returns a positive error code. This in turn 
causes make to error and abort. I know that the error can be ignored by 
preceding the patch command with a '-', but I'm not sure if this type of 
approach is good practice.

Any advice?


More information about the cs631apue mailing list