ftp://ftp.smr.ru/pub/0/FreeBSD/releases/distfiles/xscreensaver-3.16.tar.gz
[xscreensaver] / utils / ad2c
1 #!/bin/sh
2 #
3 #       ad2c : Convert app-defaults file to C strings decls.
4 #
5 #       George Ferguson, ferguson@cs.rcohester.edu, 12 Nov 1990.
6 #       19 Mar 1991 : gf
7 #               Made it self-contained.
8 #       6 Jan 1992 : mycroft@gnu.ai.mit.edu (Charles Hannum)
9 #               Removed use of "-n" and ":read" label since Gnu and
10 #               IBM sed print pattern space on "n" command. Still works
11 #               with Sun sed, of course.
12 #       7 Jan 1992: matthew@sunpix.East.Sun.COM (Matthew Stier)
13 #               Escape quotes after escaping backslashes.
14 #
15
16 sed '
17 /^!/d
18 /^$/d
19 s/\\/\\\\/g
20 s/\\$//g
21 s/"/\\"/g
22 s/^/"/
23 : test
24 /\\$/b slash
25 s/$/",/
26 p
27 d
28 : slash
29 n
30 /^!/d
31 /^$/d
32 s/"/\\"/g
33 s/\\\\/\\/g
34 s/\\n/\\\\n/g
35 s/\\t/\\\\t/g
36 s/\\f/\\\\f/g
37 s/\\b/\\\\b/g
38 b test' "$@"