aboutsummaryrefslogtreecommitdiff
path: root/utils/add_include_guard.sh
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-09-17 21:58:25 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2026-09-17 22:25:03 +0200
commit446f56c8752071ba64c7ec22968b2417c9465c8e (patch)
treefa3d07dae927d563fb67723f9e8a625cd1258eae /utils/add_include_guard.sh
parent2f9d00075b0d236ecd8431761bb045e6aa088001 (diff)
parent1f7e8e937d0e71e7eb3b5deab38b34d0a0159d88 (diff)
downloadnissy-core-446f56c8752071ba64c7ec22968b2417c9465c8e.tar.gz
nissy-core-446f56c8752071ba64c7ec22968b2417c9465c8e.zip
Merge branch 'master' into twostep-solver
Diffstat (limited to 'utils/add_include_guard.sh')
-rwxr-xr-xutils/add_include_guard.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/add_include_guard.sh b/utils/add_include_guard.sh
new file mode 100755
index 0000000..7ca10db
--- /dev/null
+++ b/utils/add_include_guard.sh
@@ -0,0 +1,15 @@
1#!/bin/sh
2
3if [ -z "$1" ]; then
4 echo "Usage: $0 [file]"
5 exit 1
6fi
7
8guard="$(echo "$1" | sed 's/^\.\///' | tr 'a-z/.' 'A-Z__')"
9
10new_file="$1.adding_include_guard"
11printf '#ifndef %s\n#define %s\n\n' "$guard" "$guard" > "$new_file"
12cat "$1" >> "$new_file"
13printf '\n#endif /* %s */\n' "$guard" >> "$new_file"
14
15mv "$new_file" "$1"

Generated with cgit - Back to sebastiano.tronto.net