~skss/usu/8.1

« back to all changes in this revision

Viewing changes to isolinux/gfxboot-theme-ubuntu/po/bin/rm_text

  • Committer: Krasimir S. Stefanov
  • Date: 2013-06-15 10:27:10 UTC
  • Revision ID: lokiisyourmaster@gmail.com-20130615102710-a8zuyypah0o1sjt9
USU 8.3... many changes :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/perl
 
2
 
 
3
# remove a text from *.po files
 
4
 
 
5
sub drop;
 
6
 
 
7
die "usage: rm_text id\n" if @ARGV != 1;
 
8
 
 
9
$id = shift;
 
10
$id = "txt_$id" unless $id =~ /^txt_/;
 
11
 
 
12
mkdir old, 0755;
 
13
 
 
14
for $f ("bootloader.pot", <*.po>) {
 
15
  if(open F, $f) {
 
16
    @f = <F>;
 
17
    close F;
 
18
 
 
19
    ( $new, $old ) = drop @f;
 
20
    if(open F, ">>old/$f") {
 
21
      print F @$old;
 
22
      close F;
 
23
 
 
24
      open F, ">$f";
 
25
      print F @$new;
 
26
      close F;
 
27
    }
 
28
  }
 
29
}
 
30
 
 
31
 
 
32
sub drop
 
33
{
 
34
  local $_;
 
35
  my (@f, @g, $drop_it, @d);
 
36
 
 
37
  for (@_) {
 
38
    push @g, $_;
 
39
    $drop_it = 1 if /^#\.\s*${id}\s*$/;
 
40
    if(/^\s*$/) {
 
41
      if($drop_it) {
 
42
        push @d, @g;
 
43
      }
 
44
      else {
 
45
        push @f, @g;
 
46
      }
 
47
      undef $drop_it;
 
48
      undef @g;
 
49
    }
 
50
  }
 
51
 
 
52
  if(@g) {
 
53
    if($drop_it) {
 
54
      push @d, @g;
 
55
    }
 
56
    else {
 
57
      push @f, @g;
 
58
    }
 
59
  }
 
60
 
 
61
  return ( \@f, \@d );
 
62
}
 
63