2017-12-24 16:24:04 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use warnings;
|
2010-11-18 20:26:40 +00:00
|
|
|
|
2013-11-07 12:54:54 +00:00
|
|
|
my $ARRAYNAME = $ARGV[0];
|
2014-10-22 12:03:34 +00:00
|
|
|
my $first = 0;
|
|
|
|
print "static const char $ARRAYNAME\[\] = {";
|
2010-11-18 20:26:40 +00:00
|
|
|
|
2013-11-07 12:54:54 +00:00
|
|
|
for ($i = 1; $i <= $#ARGV; $i = $i + 1) {
|
|
|
|
my $FILENAME = $ARGV[$i];
|
|
|
|
open FILE, $FILENAME or die "Cannot open $FILENAME";
|
|
|
|
while (my $line = <FILE>) {
|
|
|
|
foreach my $c (split //, $line) {
|
2014-10-22 12:03:34 +00:00
|
|
|
if ($first == 1) {
|
|
|
|
printf (",\n");
|
|
|
|
}
|
|
|
|
printf ("0x%02x", ord ($c));
|
|
|
|
$first = 1;
|
2013-11-07 12:54:54 +00:00
|
|
|
}
|
|
|
|
}
|
2010-11-18 20:26:40 +00:00
|
|
|
}
|
2013-11-07 12:54:54 +00:00
|
|
|
|
2014-10-22 12:03:34 +00:00
|
|
|
print "};\n";
|
2013-11-07 12:54:54 +00:00
|
|
|
|