view ifndef_wrapper.sh @ 1327:e47e4b8a005d

initialize variable and protect against NULL dereferencement
author Francois Perrad <francois.perrad@gadz.org>
date Tue, 15 Nov 2016 15:36:05 +0100
parents 750ec4ec4cbe
children 198e2ee0f4b1
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/'