~ubuntu-branches/ubuntu/quantal/mc/quantal

« back to all changes in this revision

Viewing changes to vfs/extfs/deba.in

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Drolez
  • Date: 2006-08-24 22:19:03 UTC
  • mfrom: (2.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20060824221903-v7g8c4t1het21fy8
Tags: 1:4.6.1-6
* debian/rules modified to fix a FTBFS during the 2nd build. Closes: #384302
* added 05_symcrash.patch to fix a segfault (should be in mc's CVS). Closes: #383341
* mpg123 title view fixed. Closes: #391644

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
#
7
7
# deba
8
8
 
9
 
sub bt
10
 
{
11
 
    my ($dt) = @_;
12
 
    my (@time);
13
 
    @time = localtime($dt);
14
 
    $bt = sprintf "%02d-%02d-%d %02d:%02d", $time[4] + 1, $time[3],
15
 
                  $time[5] + 1900, $time[2], $time[1];
16
 
    return $bt;
17
 
}
18
 
 
19
 
 
20
 
sub ft
21
 
{
22
 
    my ($f) = @_;
23
 
    return "d" if -d $f;
24
 
    return "l" if -l $f;
25
 
    return "p" if -p $f;
26
 
    return "S" if -S $f;
27
 
    return "b" if -b $f;
28
 
    return "c" if -c $f;
29
 
    return "-";
30
 
}
31
 
 
32
 
sub fm
33
 
{
34
 
    my ($n) = @_;
35
 
    my ($m);
36
 
 
37
 
    if( $n & 0400 ) {
38
 
       $m .= "r";
39
 
    } else {
40
 
       $m .= "-";
41
 
    }
42
 
    if( $n & 0200 ) {
43
 
       $m .= "w";
44
 
    } else {
45
 
       $m .= "-";
46
 
    }
47
 
    if( $n & 04000 ) {
48
 
       $m .= "s";
49
 
    } elsif( $n & 0100 ) {
50
 
       $m .= "x";
51
 
    } else {
52
 
       $m .= "-";
53
 
    }
54
 
 
55
 
    if( $n & 0040 ) {
56
 
       $m .= "r";
57
 
    } else {
58
 
       $m .= "-";
59
 
    }
60
 
    if( $n & 0020 ) {
61
 
       $m .= "w";
62
 
    } else {
63
 
       $m .= "-";
64
 
    }
65
 
    if( $n & 02000 ) {
66
 
       $m .= "s";
67
 
    } elsif( $n & 0010 ) {
68
 
       $m .= "x";
69
 
    } else {
70
 
       $m .= "-";
71
 
    }
72
 
 
73
 
    if( $n & 0004 ) {
74
 
       $m .= "r";
75
 
    } else {
76
 
       $m .= "-";
77
 
    }
78
 
    if( $n & 0002 ) {
79
 
       $m .= "w";
80
 
    } else {
81
 
       $m .= "-";
82
 
    }
83
 
    if( $n & 01000 ) {
84
 
       $m .= "t";
85
 
    } elsif( $n & 0001 ) {
86
 
       $m .= "x";
87
 
    } else {
88
 
       $m .= "-";
89
 
    }
90
 
 
91
 
    return $m;
92
 
}
93
 
 
94
 
sub ls {
95
 
    my ($file) = @_;
96
 
    my @stat = stat($file);
97
 
    # mode, nlink, uid, gid, size, mtime, filename
98
 
    printf "%s%s %d %d %d %d %s CONTENTS%s\n", ft($file), fm($stat[2] & 07777),
99
 
    $stat[3], $stat[4], $stat[5], $stat[7], bt($stat[9]), $file;
 
9
sub quote {
 
10
    $_ = shift(@_);
 
11
    s/([^\w\/.+-])/\\$1/g;
 
12
    return($_);
100
13
}
101
14
 
102
15
sub list
103
16
{
104
 
       my($archive)=@_;
 
17
       my($qarchive)=@_;
 
18
       $qarchive = quote($qarchive);
105
19
       chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`);
106
 
       chop($info_size=`apt-cache show $archive | wc -c`);
 
20
       chop($info_size=`apt-cache show $qarchive | wc -c`);
107
21
       $install_size=length($pressinstall);
108
22
       $upgrade_size=length($pressupgrade);
109
23
 
110
24
       print "-r--r--r--   1 root     root     $info_size $date INFO\n";
111
25
 
112
 
       chop($debd = `dpkg -s $archive | grep -i ^Version | sed 's/^version: //i'`);
113
 
       chop($deba = `apt-cache show $archive | grep -i ^Version | sed 's/^version: //i'`);
 
26
       chop($debd = `dpkg -s $qarchive | grep -i ^Version | sed 's/^version: //i'`);
 
27
       chop($deba = `apt-cache show $qarchive | grep -i ^Version | sed 's/^version: //i'`);
114
28
       if( ! $debd ) {
115
29
           print "-r-xr--r--   1 root     root     $install_size $date INSTALL\n";
116
30
       } elsif( $debd ne $deba ) {
121
35
sub copyout
122
36
{
123
37
       my($archive,$filename,$destfile)=@_;
124
 
 
 
38
       my $qarchive = quote($archive);
 
39
       my $qdestfile = quote($destfile);
125
40
       if($filename eq "INFO") {
126
 
           system("apt-cache show $archive > $destfile");
 
41
           system("apt-cache show $qarchive > $qdestfile");
127
42
        } elsif($filename eq "INSTALL")        {
128
 
           if ( open(FILEOUT,">$destfile") ) {
 
43
           if ( open(FILEOUT, "> $destfile") ) {
129
44
               print FILEOUT $pressinstall;
130
45
               close FILEOUT;
131
 
               system("chmod a+x $destfile");
 
46
               system("chmod a+x $qdestfile");
132
47
           }
133
48
       } elsif($filename eq "UPGRADE") {
134
 
           if ( open(FILEOUT,">$destfile") ) {
 
49
           if ( open(FILEOUT, ">, $destfile") ) {
135
50
               print FILEOUT $pressupgrade;
136
51
               close FILEOUT;
137
 
               system("chmod a+x $destfile");
 
52
               system("chmod a+x $qdestfile");
138
53
           }
139
54
       } else {
140
55
           die "extfs: $filename: No such file or directory\n";
144
59
sub run
145
60
{
146
61
       my($archive,$filename)=@_;
 
62
       my $qarchive = quote($archive);
147
63
       if($filename eq "INSTALL") {
148
 
           system("apt-get install $archive");
 
64
           system("apt-get install $qarchive");
149
65
       } elsif($filename eq "UPGRADE") {
150
 
           system("apt-get install $archive");
 
66
           system("apt-get install $qarchive");
151
67
       } else {
152
68
           die "extfs: $filename: Permission denied\n";
153
69
       }