From 727b7ea4d42233ab2fa321ebca36f7a48febda58 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sat, 9 Dec 2017 18:52:53 +0100 Subject: updated license generator script to use wide characters when generating the header file (licenses contain non-ASCII characters) --- gen_license_include.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'gen_license_include.sh') diff --git a/gen_license_include.sh b/gen_license_include.sh index af41415..16de0b2 100755 --- a/gen_license_include.sh +++ b/gen_license_include.sh @@ -7,13 +7,22 @@ OUTFILE="$(dirname $0)/src/license.h" echo "$(basename $0): generating ${OUTFILE} from ${LICENSE}" -echo '#ifndef LICENSE_H' >${OUTFILE} +echo -n >${OUTFILE} +echo '/*' >>${OUTFILE} +echo " * File: ${OUTFILE}" >>${OUTFILE} +echo " * Generated by: $(basename $0) [user: $(id -nu)]" >>${OUTFILE} +echo ' *' >>${OUTFILE} +echo " * Autogenerated license pre-processor macro from ${LICENSE}" >>${OUTFILE} +echo ' * Remember to use std::wstring instead of std::string' >>${OUTFILE} +echo ' * for ALL_LICENSES (contains non-ASCII characters).' >>${OUTFILE} +echo ' */' >>${OUTFILE} +echo '#ifndef LICENSE_H' >>${OUTFILE} echo '#define LICENSE_H 1' >>${OUTFILE} echo "\n" >>${OUTFILE} echo '#define ALL_LICENSES \' >>${OUTFILE} # first sed will escape all existing double quotes # second sed will C-ify the text -cat "${LICENSE}" | sed 's/\"/\\"/g' | sed 's/\(.*\)/\"\1\\n\" \\/g' >>${OUTFILE} -echo '""' >>${OUTFILE} +cat "${LICENSE}" | sed 's/\"/\\"/g' | sed 's/\(.*\)/L\"\1\\n\" \\/g' >>${OUTFILE} +echo 'L""' >>${OUTFILE} echo "\n" >>${OUTFILE} echo '#endif' >>${OUTFILE} -- cgit v1.2.3