chiark / gitweb /
distribution fixes
[disorder] / scripts / text2c
1 #! /usr/bin/perl -w
2 my $class = "static";
3 if($ARGV[0] eq '-extern') {
4     $class = "";
5     shift;
6 }
7 my $name = shift;
8 push(@out, "/* autogenerated file, do not edit */\n\n");
9 push(@out, "$class const char $name\[] = \n");
10 while(<>) {
11     next if /arch-tag/;
12     s/[\\\"\?]/\\$&/g;
13     s/\n/\\n/g;
14     push(@out, "  \"$_\"\n");
15 }
16 push(@out, ";\n");
17 ((print @out)
18  and (close STDOUT))
19     or die "$0: stdout: $!\n";