2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 18:07:40 +00:00
ovs/build-aux/text2c

17 lines
378 B
Plaintext
Raw Permalink Normal View History

#! /usr/bin/python3
import re
import sys
"""This utility reads its input, which should be plain text, and
prints it back transformed into quoted strings that may be #included
into C source code."""
while True:
line = sys.stdin.readline()
if not line:
break
s = line.replace("\\", "\\\\").replace('"', '\\"').replace("\n", "\\n")
print('"' + s + '"')