File: s2c.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 (20 lines) | stat: -rw-r--r-- 325 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
#	sed script to extract C code wrapped as a C string.
#
# Remove "s enclossing each line
s/^"\(.*\)"$/\1/
#
# Remove trailing new-line
s/^\(.*\)\\n$/\1/
#
# Unquote "
s/\\"/"/g
#
# Unduplicate \
s/\\\\/\\/g
#
# Quote unquoted and unduplicated %
s/\([^\\%]\)%\([^%]\)/\1\\%\2/g
#
# Unduplicate unquoted %
s/\([^\\]%\)%/\1/g