comparison ifndef_wrapper.sh @ 1612:470aa609c7e4

avoid extended regex features to avoid caring about sed -r vs -E
author Matt Johnston <matt@ucc.asn.au>
date Tue, 24 Jul 2018 20:19:05 +0800
parents 198e2ee0f4b1
children
comparison
equal deleted inserted replaced
1554:1c66ca4f3791 1612:470aa609c7e4
1 #!/bin/sh 1 #!/bin/sh
2 2
3 # Wrap all "#define X Y" with a #ifndef X...#endif" 3 # Wrap all "#define X Y" with a #ifndef X...#endif"
4 4
5 sed -E 's/^( *#define ([^ ]+) .*)/#ifndef \2\ 5 sed 's/^\( *#define \([^ ][^ ]*\) .*\)/#ifndef \2\
6 \1\ 6 \1\
7 #endif/' 7 #endif/'