summaryrefslogtreecommitdiffstats
path: root/3rdparty/openpgm-svn-r1085/pgm/htdocs/convert_to_macro.pl
blob: bea44af3ac8e6eac90956c7b810897c9a0b45b42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl

use strict;
use File::Basename;

die "usage: $0 [text file]\n" unless ($ARGV[0]);
open(MOO, $ARGV[0]) or die "cannot open $ARGV[0]: $!";
my $all = do { local $/; <MOO> };
close(MOO);
$all =~ s/"/\\"/g;
$all =~ s/\n/\\n/mg;
$all =~ s/\r/\\r/mg;

my $var = uc (basename($ARGV[0]));
$var =~ s/\s+/_/g;
$var =~ s/\./_/g;

print<<MOO;
#define WWW_$var	"$all"
MOO