view ifndef_wrapper.sh @ 1604:99ca393afc56

It turns out you can't have a single-quote in an #error
author Matt Johnston <matt@ucc.asn.au>
date Thu, 08 Mar 2018 22:37:54 +0800
parents 198e2ee0f4b1
children 0196f4f83fee
line wrap: on
line source

#!/bin/sh

# Wrap all "#define X Y" with a #ifndef X...#endif"

sed -E 's/^( *#define ([^ ]+) .*)/#ifndef \2\
\1\
#endif/'