Gputils .lib VFS handler



Respected developers!

My English is limited. The translated text of a letter to translate.google.com.
The patch on the gputils archive (.lib) manages the VFS using.

Best regards:

Molnár Károly
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
--- mc-4.8.1.orig/configure.ac	2012-02-25 16:53:02.000000000 +0100
+++ mc-4.8.1/configure.ac	2012-03-06 16:17:38.000000000 +0100
@@ -561,6 +561,7 @@
 src/vfs/extfs/helpers/ucab
 src/vfs/extfs/helpers/uha
 src/vfs/extfs/helpers/ulha
+src/vfs/extfs/helpers/ulib
 src/vfs/extfs/helpers/urar
 src/vfs/extfs/helpers/uzip
 src/vfs/extfs/helpers/uzoo
diff -ruN mc-4.8.1.orig/misc/mc.ext.in mc-4.8.1/misc/mc.ext.in
--- mc-4.8.1.orig/misc/mc.ext.in	2012-01-08 17:26:48.000000000 +0100
+++ mc-4.8.1/misc/mc.ext.in	2012-03-06 16:18:09.000000000 +0100
@@ -216,6 +216,11 @@
 	#Open=%view{ascii} ar tv %f
 	View=%view{ascii} file %f && nm -C %f
 
+# lib
+regex/\.([Ll]ib|LIB)$
+	Open=%cd %p/ulib://
+	View=%view{ascii} gplib -t %f | gawk '{printf "%%-30s | %%10d | %%s.%%s.%%02d | %%s\n", $1, strtonum($2), $8, tolower($5), $6, $7}'
+
 # trpm
 regex/\.trpm$
 	Open=%cd %p/trpm://
diff -ruN mc-4.8.1.orig/src/vfs/extfs/helpers/Makefile.am mc-4.8.1/src/vfs/extfs/helpers/Makefile.am
--- mc-4.8.1.orig/src/vfs/extfs/helpers/Makefile.am	2011-09-14 20:12:02.000000000 +0200
+++ mc-4.8.1/src/vfs/extfs/helpers/Makefile.am	2012-03-06 16:18:44.000000000 +0100
@@ -33,6 +33,7 @@
 	ucab.in			\
 	uha.in			\
 	ulha.in			\
+	ulib.in			\
 	urar.in			\
 	uzip.in			\
 	uzoo.in
@@ -62,6 +63,7 @@
 	ucab			\
 	uha			\
 	ulha			\
+	ulib			\
 	urar			\
 	uzip			\
 	uzoo
diff -ruN mc-4.8.1.orig/src/vfs/extfs/helpers/README.extfs mc-4.8.1/src/vfs/extfs/helpers/README.extfs
--- mc-4.8.1.orig/src/vfs/extfs/helpers/README.extfs	2011-08-10 09:43:14.000000000 +0200
+++ mc-4.8.1/src/vfs/extfs/helpers/README.extfs	2012-03-06 16:18:57.000000000 +0100
@@ -70,3 +70,6 @@
 gitfs - browse the git repo
 changesetfs - list of versions of current file
 patchsetfs - list of patches of current file
+
+# Gputils lib archives.
+ulib
diff -ruN mc-4.8.1.orig/src/vfs/extfs/helpers/ulib.in mc-4.8.1/src/vfs/extfs/helpers/ulib.in
--- mc-4.8.1.orig/src/vfs/extfs/helpers/ulib.in	1970-01-01 01:00:00.000000000 +0100
+++ mc-4.8.1/src/vfs/extfs/helpers/ulib.in	2012-03-06 16:19:24.000000000 +0100
@@ -0,0 +1,145 @@
+#! @PERL@ -w
+#
+# VFS to manage the gputils archives.
+# Written by Molnár Károly (proton7 freemail hu) 2012
+#
+
+my %month = ('jan' => '01', 'feb' => '02', 'mar' => '03',
+	     'apr' => '04', 'may' => '05', 'jun' => '06',
+	     'jul' => '07', 'aug' => '08', 'sep' => '09',
+	     'oct' => '10', 'nov' => '11', 'dec' => '12');
+
+my @PATHS = ('/usr/bin/gplib', '/usr/local/bin/gplib');
+
+my $gplib = '';
+
+foreach my $i (@PATHS)
+  {
+  if (-x $i)
+    {
+    $gplib = $i;
+    last;
+    }
+  }
+
+if ($gplib eq '')
+  {
+  print STDERR "\a\t$0 : Gplib not found!\n";
+  exit(1);
+  }
+
+my $cmd = shift;
+my $archive = shift;
+
+#-------------------------------------------------------------------------------
+
+sub mc_ulib_fs_list
+  {
+  open(PIPE, "$gplib -tq $archive |") || die("Error in $gplib -tq");
+
+  my($dev, $inode, $mode, $nlink, $uid, $gid) = stat($archive);
+
+  while (<PIPE>)
+    {
+    chomp;
+    my @w = split(/\s+/o);
+    my $fname = $w[0];
+
+    $fname =~ s|\\|/|g;
+
+    printf("-rw-r--r-- 1 %s %s %d %s-%02u-%s %s %s\n",
+	   $uid, $gid, int($w[1]), $month{lc($w[4])}, $w[5], $w[7], substr($w[6], 0, 5), $fname);
+    }
+
+  close (PIPE);
+  }
+
+#-------------------------------------------------------------------------------
+
+sub mc_ulib_fs_copyin
+  {
+  system("$gplib -r $archive $_[0]");
+  my $ret = $?;
+
+  if ($ret)
+    {
+    die("Error in: $gplib -r");
+    }
+  }
+
+#-------------------------------------------------------------------------------
+
+sub mc_ulib_fs_copyout
+  {
+  my($module, $fname) = @_;
+  my $tmpdir = $ENV{'TMPDIR'};
+
+  $tmpdir = '/tmp' if ($tmpdir eq '');
+
+  open(PIPE, "$gplib -tq $archive |") || die("Error in: $gplib -tq");
+
+  while (<PIPE>)
+    {
+    chomp;
+    my @w = split(/\s+/o);
+    my $module_orig = $w[0];
+    my $count = () = ($module_orig =~ /(\\)/g);
+    my $md = $module_orig;
+
+    $md =~ s|\\|/|g;
+
+    if ($module eq $md)
+      {
+      return if ($count);
+      }
+    }
+
+  close (PIPE);
+
+  chdir($tmpdir);
+  system("$gplib -x $archive $module");
+  my $ret = $?;
+
+  if ($ret)
+    {
+    die("Error in: $gplib -x");
+    }
+
+  rename($module, $fname) || die("Error in: rename($module, $fname)");
+  }
+
+#-------------------------------------------------------------------------------
+
+sub mc_ulib_fs_rm
+  {
+  system("$gplib -d $archive $_[0]");
+  my $ret = $?;
+
+  if ($ret)
+    {
+    die("Error in: $gplib -d");
+    }
+  }
+
+################################################################################
+
+if ($cmd eq 'list')
+  {
+  mc_ulib_fs_list(@ARGV);
+  }
+elsif ($cmd eq 'copyin')
+  {
+  mc_ulib_fs_copyin(@ARGV);
+  }
+elsif ($cmd eq 'copyout')
+  {
+  mc_ulib_fs_copyout(@ARGV);
+  }
+elsif ($cmd eq 'rm')
+  {
+  mc_ulib_fs_rm(@ARGV);
+  }
+else
+  {
+  exit(1);
+  }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]