mirror-cockpit-project-cockpit/tools/escape-to-c
2022-01-13 18:27:40 +01:00

12 lines
318 B
Python
Executable file

#!/usr/bin/python3
# ...until #embed comes along...
# eg: tools/escape-to-c cockpit_webresponse_fail_html_text < fail.html > fail.html.c
import json
import sys
# Use a pointer to allow overriding the value
print('const char *', sys.argv[1], '=\n',
*[json.dumps(line) + '\n' for line in sys.stdin],
';')