File: c2s.sed

package info (click to toggle)
shc 3.7-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 208 kB
  • ctags: 104
  • sloc: ansic: 1,121; makefile: 93; sh: 28; sed: 12; csh: 2
file content (21 lines) | stat: -rw-r--r-- 256 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
#	sed script to wrapp C code as a C string.
#
# Duplicate unquoted %
s/[^\\]%/&%/g
#
# Unquote quoted %
s/\\%/%/g
#
# Duplicate \
s/\\/\\\\/g
#
# Quote "
s/"/\\"/g
#
# End each line with new-line
s/^.*$/&\\n/
#
# Enclose each line within "
s/^.*$/"&"/
#