Ticket #2751: mc-4.8.1-ulib.patch

File mc-4.8.1-ulib.patch, 4.9 KB (added by slavazanko, 12 years ago)
  • configure.ac

    diff -ruN mc-4.8.1.orig mc-4.8.1
    diff -ruN mc-4.8.1.orig/configure.ac mc-4.8.1/configure.ac
    old new  
    561561src/vfs/extfs/helpers/ucab 
    562562src/vfs/extfs/helpers/uha 
    563563src/vfs/extfs/helpers/ulha 
     564src/vfs/extfs/helpers/ulib 
    564565src/vfs/extfs/helpers/urar 
    565566src/vfs/extfs/helpers/uzip 
    566567src/vfs/extfs/helpers/uzoo 
  • misc/mc.ext.in

    diff -ruN mc-4.8.1.orig/misc/mc.ext.in mc-4.8.1/misc/mc.ext.in
    old new  
    216216        #Open=%view{ascii} ar tv %f 
    217217        View=%view{ascii} file %f && nm -C %f 
    218218 
     219# lib 
     220regex/\.([Ll]ib|LIB)$ 
     221        Open=%cd %p/ulib:// 
     222        View=%view{ascii} gplib -t %f | gawk '{printf "%%-30s | %%10d | %%s.%%s.%%02d | %%s\n", $1, strtonum($2), $8, tolower($5), $6, $7}' 
     223 
    219224# trpm 
    220225regex/\.trpm$ 
    221226        Open=%cd %p/trpm:// 
  • src/vfs/extfs/helpers/Makefile.am

    diff -ruN mc-4.8.1.orig/src/vfs/extfs/helpers/Makefile.am mc-4.8.1/src/vfs/extfs/helpers/Makefile.am
    old new  
    3333        ucab.in                 \ 
    3434        uha.in                  \ 
    3535        ulha.in                 \ 
     36        ulib.in                 \ 
    3637        urar.in                 \ 
    3738        uzip.in                 \ 
    3839        uzoo.in 
     
    6263        ucab                    \ 
    6364        uha                     \ 
    6465        ulha                    \ 
     66        ulib                    \ 
    6567        urar                    \ 
    6668        uzip                    \ 
    6769        uzoo 
  • src/vfs/extfs/helpers/README.extfs

    diff -ruN mc-4.8.1.orig/src/vfs/extfs/helpers/README.extfs mc-4.8.1/src/vfs/extfs/helpers/README.extfs
    old new  
    7070gitfs - browse the git repo 
    7171changesetfs - list of versions of current file 
    7272patchsetfs - list of patches of current file 
     73 
     74# Gputils lib archives. 
     75ulib 
  • src/vfs/extfs/helpers/ulib.in

    diff -ruN mc-4.8.1.orig/src/vfs/extfs/helpers/ulib.in mc-4.8.1/src/vfs/extfs/helpers/ulib.in
    old new  
     1#! @PERL@ -w 
     2# 
     3# VFS to manage the gputils archives. 
     4# Written by Molnár Károly (proton7@freemail.hu) 2012 
     5# 
     6 
     7my %month = ('jan' => '01', 'feb' => '02', 'mar' => '03', 
     8             'apr' => '04', 'may' => '05', 'jun' => '06', 
     9             'jul' => '07', 'aug' => '08', 'sep' => '09', 
     10             'oct' => '10', 'nov' => '11', 'dec' => '12'); 
     11 
     12my @PATHS = ('/usr/bin/gplib', '/usr/local/bin/gplib'); 
     13 
     14my $gplib = ''; 
     15 
     16foreach my $i (@PATHS) 
     17  { 
     18  if (-x $i) 
     19    { 
     20    $gplib = $i; 
     21    last; 
     22    } 
     23  } 
     24 
     25if ($gplib eq '') 
     26  { 
     27  print STDERR "\a\t$0 : Gplib not found!\n"; 
     28  exit(1); 
     29  } 
     30 
     31my $cmd = shift; 
     32my $archive = shift; 
     33 
     34#------------------------------------------------------------------------------- 
     35 
     36sub mc_ulib_fs_list 
     37  { 
     38  open(PIPE, "$gplib -tq $archive |") || die("Error in $gplib -tq"); 
     39 
     40  my($dev, $inode, $mode, $nlink, $uid, $gid) = stat($archive); 
     41 
     42  while (<PIPE>) 
     43    { 
     44    chomp; 
     45    my @w = split(/\s+/o); 
     46    my $fname = $w[0]; 
     47 
     48    $fname =~ s|\\|/|g; 
     49 
     50    printf("-rw-r--r-- 1 %s %s %d %s-%02u-%s %s %s\n", 
     51           $uid, $gid, int($w[1]), $month{lc($w[4])}, $w[5], $w[7], substr($w[6], 0, 5), $fname); 
     52    } 
     53 
     54  close (PIPE); 
     55  } 
     56 
     57#------------------------------------------------------------------------------- 
     58 
     59sub mc_ulib_fs_copyin 
     60  { 
     61  system("$gplib -r $archive $_[0]"); 
     62  my $ret = $?; 
     63 
     64  if ($ret) 
     65    { 
     66    die("Error in: $gplib -r"); 
     67    } 
     68  } 
     69 
     70#------------------------------------------------------------------------------- 
     71 
     72sub mc_ulib_fs_copyout 
     73  { 
     74  my($module, $fname) = @_; 
     75  my $tmpdir = $ENV{'TMPDIR'}; 
     76 
     77  $tmpdir = '/tmp' if ($tmpdir eq ''); 
     78 
     79  open(PIPE, "$gplib -tq $archive |") || die("Error in: $gplib -tq"); 
     80 
     81  while (<PIPE>) 
     82    { 
     83    chomp; 
     84    my @w = split(/\s+/o); 
     85    my $module_orig = $w[0]; 
     86    my $count = () = ($module_orig =~ /(\\)/g); 
     87    my $md = $module_orig; 
     88 
     89    $md =~ s|\\|/|g; 
     90 
     91    if ($module eq $md) 
     92      { 
     93      return if ($count); 
     94      } 
     95    } 
     96 
     97  close (PIPE); 
     98 
     99  chdir($tmpdir); 
     100  system("$gplib -x $archive $module"); 
     101  my $ret = $?; 
     102 
     103  if ($ret) 
     104    { 
     105    die("Error in: $gplib -x"); 
     106    } 
     107 
     108  rename($module, $fname) || die("Error in: rename($module, $fname)"); 
     109  } 
     110 
     111#------------------------------------------------------------------------------- 
     112 
     113sub mc_ulib_fs_rm 
     114  { 
     115  system("$gplib -d $archive $_[0]"); 
     116  my $ret = $?; 
     117 
     118  if ($ret) 
     119    { 
     120    die("Error in: $gplib -d"); 
     121    } 
     122  } 
     123 
     124################################################################################ 
     125 
     126if ($cmd eq 'list') 
     127  { 
     128  mc_ulib_fs_list(@ARGV); 
     129  } 
     130elsif ($cmd eq 'copyin') 
     131  { 
     132  mc_ulib_fs_copyin(@ARGV); 
     133  } 
     134elsif ($cmd eq 'copyout') 
     135  { 
     136  mc_ulib_fs_copyout(@ARGV); 
     137  } 
     138elsif ($cmd eq 'rm') 
     139  { 
     140  mc_ulib_fs_rm(@ARGV); 
     141  } 
     142else 
     143  { 
     144  exit(1); 
     145  }