aboutsummaryrefslogtreecommitdiff
path: root/gen_license_include.sh
diff options
context:
space:
mode:
authorToni Uhlig <Toni.Uhlig@tq-group.com>2017-12-09 18:52:53 +0100
committerToni Uhlig <Toni.Uhlig@tq-group.com>2017-12-09 18:57:59 +0100
commit727b7ea4d42233ab2fa321ebca36f7a48febda58 (patch)
tree6e5472c61cb2380bd69316f71f17ed5b81676e60 /gen_license_include.sh
parentb7d14328f5db3aef6b7f0970b5fe63372c0157d6 (diff)
updated license generator script to use wide characters when generating the header file (licenses contain non-ASCII characters)
Diffstat (limited to 'gen_license_include.sh')
-rwxr-xr-xgen_license_include.sh15
1 files changed, 12 insertions, 3 deletions
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}