Created
August 29, 2012 18:43
-
-
Save wereHamster/3516935 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/bash | |
# Add ifndef/define/endif to headers which use pragma once. I used | |
# it to edit some C++ project which wouldn't compile because the | |
# compiler didn't understand pragma once. SunCC, I'm looking at you! | |
~/bin/ack -l 'pragma once' | while read file; do | |
f="${file//\//_}" | |
f="${f//./_}" | |
f="$(echo "$f" | tr '[:lower:]' '[:upper:]')" | |
gsed -i "/#pragma once/ { | |
a#ifndef $f | |
a#define $f | |
}; \$a#endif /* $f */" $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment