script for once-ification

This still tends to require by-hand cleanups of bare #endif lines
This commit is contained in:
Paul Davis 2024-09-22 12:52:10 -06:00
parent 56ce9c33c0
commit 8fbec13e9c

7
tools/once Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
for x in *.h ; do
sed -i -e 's/^#ifndef *__[a-z_][a-z_]*_h__/#pragma once/' -e '/^#define *__[a-z_][a-z_]*_h__/d' -e '/^#endif *\/\* __[a-z_][a-z_]*_h__.*$/d' -e '/^#endif *\/\/ *__[a-z_][a-z_]*_h__.*$/d' $x
done
exit 0