2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-22 09:57:41 +00:00
kea/fuzz/input/regenerate-cpp-sources.sh

27 lines
480 B
Bash
Raw Normal View History

#!/bin/sh
set -eu
script_path=$(cd "$(dirname "${0}")" && pwd)
cd "${script_path}"
generate() {
source="${1}"
target="${2}"
source_content=$(cat "${source}")
variable_name=$(echo "${source}" | tr '[:lower:]' '[:upper:]' | sed 's/\./_/' | sed 's/-/_/')
cat > "${target}" <<HERE_DOCUMENT
#include <string>
extern std::string ${variable_name} = R"(
${source_content}
)";
HERE_DOCUMENT
}
generate kea-dhcp4.conf ../kea-dhcp4.h
generate kea-dhcp6.conf ../kea-dhcp6.h