8 function startswith() {
10 declare -l prelude="${2}"
11 declare -l line=$(head -n1 "$file")
12 if [ "$line" != "$prelude" ]; then
13 echo "$prelude" | cat - "$file" > "$file.tmp" && mv "$file.tmp" "$file"
18 declare -l base="${1}"
19 find "$base" -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
20 [ "$VERBOSE" != "0" ] && echo "$file"
21 declare -l file_h="${file%.qc}.qh"
22 if [[ ! -f "$file_h" ]]; then echo "#pragma once" > "$file_h"; fi
24 include=$(basename "$file")
25 include="${include%.qc}.qh"
26 include="#include \"${include}\""
27 startswith "$file" "$include"
29 find "$base" -type f -name '*.qh' -a \! -name '_mod.qh' -print0 | sort -z | while read -r -d '' file; do
30 [ "$VERBOSE" != "0" ] && echo "$file"
31 startswith "$file" "#pragma once"