summaryrefslogtreecommitdiff
path: root/scripts/newbitmaps/old_releases/mario/makelines.sh
blob: fca0f9c4dbd304a7ab5f53b119afc6a081dc7245 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/perl
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

use strict;
our $opt_u = 'http://www.chromium.org';
our $opt_m = 'Unsupported Prototype 0000';
our $opt_d = '.';

use File::Basename;
my $progdir = dirname($0);
my $prog = basename($0);

use Getopt::Std;
my $usage = "
Usage:  $prog

";
getopts('u:m:d:') or die $usage;

my @old = glob("$opt_d/linetxt_*");
unlink(@old) if @old;

$/ = undef;
$_ = <>;
s/\s+$//gs;

my $count = 1;
foreach (split(/\n/, $_))
{
    s/^\s+//;
    s/\s+$//;
    s/\$URL/$opt_u/g;
    s/\$MODEL/$opt_m/g;
    $_ = ' ' unless $_;
    my $big = s/^\$BIG:\s*//;
    my $filename = sprintf('%s/linetxt_%02d.%s', $opt_d, $count++,
                           $big ? 'TXT' : 'txt');
#    print "$filename: ($_)\n"; next;
    open(OUT, ">$filename") || die "$0 can't write $filename: $!\n";
    print OUT "$_";
    close(OUT);
}