If you've taken an OS/161 based operating systems course, you probably ran into one of those fun little eccentricities that makes higher education so enjoyable: the requirement that all code be added in
For example, if the original code looks like this:
int foo = 3;
And I change it to:
int foo = 4;
I'm actually required to submit something that looks like this:
#if !STUFF int foo = 3; #else int foo = 4; #endif
Well, my friend Dave didn't find this very amusing, so he commissioned me to write a script which would massage a diff produced by
$VCS diff, adding all the
#ifs required to make the TAs happy :
$ hg diff -r initial: ... -int foo = 3; +int foo = 4; ... $ !! | ifdiff STUFF ... +#if !STUFF int foo = 3; +#endif +#if STUFF +int foo = 4 +#endif ...
The code can be downloaded and forked over at GitHub: ifdiff — http://gist.github.com/612687.
: For the record, CSC369 was one of my favorite courses.