9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Utility to extract the plan9.9gz files
@ 2000-06-12 10:29 Fabricio Chalub
  2000-06-16 14:47 ` Steve Kotsopoulos
  0 siblings, 1 reply; 2+ messages in thread
From: Fabricio Chalub @ 2000-06-12 10:29 UTC (permalink / raw)
  To: 9fans

Frustrated that I couldn't install the Plan9 on my machine
(incompatible VGA chipset), I assumed that I have at least
the right to take a look at the source code. ;)

Since there isn't any utility to extract the contents of
the plan9.9gz file *outside* the realm of the operating system
itself, I did the only thing to do: created my own. (I even
sent an e-mail to this newsgroup earlier today, but got too
anxious to wait for a---possibly negative---answer).

So here it is: it creates the tree structure of the plan9.9gz
file inside the directory you run it.

You need to gunzip the plan9.9gz file, and call it plan9.9, or
modify the source. ;)

Enjoy.  Comments are appreciated.  If this is in violation of
any copyright policy, just ignore it. ;)

fc

#!/usr/bin/perl
# Unpack the plan9.9gz file
# unpack-plan9.pl, v 11062000
# (c) Fabricio Chalub, chalub@gnu.org

open F, "plan9.9";

while (<F>)
{
    /(.*) (.*) (.*) (.*) (.*) (.*)/;
    $filename = $1;
    $filename = substr ($filename, 1);
    $length = $6;
    read F, $buffer, $length;
    print "$filename\n";
    if ($length == 0)
    {
	mkdir $filename, 0700;
    }
    else
    {
	open O, ">$filename";
	print O $buffer;
	close O;
    }
}


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] Utility to extract the plan9.9gz files
  2000-06-12 10:29 [9fans] Utility to extract the plan9.9gz files Fabricio Chalub
@ 2000-06-16 14:47 ` Steve Kotsopoulos
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Kotsopoulos @ 2000-06-16 14:47 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

Fabricio Chalub wrote:
> Since there isn't any utility to extract the contents of
> the plan9.9gz file *outside* the realm of the operating system
> itself, I did the only thing to do: created my own.
>
> So here it is: it creates the tree structure of the plan9.9gz
> file inside the directory you run it.
>
> You need to gunzip the plan9.9gz file, and call it plan9.9, or
> modify the source. ;)

Here's Fabricio's script, modified to take any package name on
the command line, and do the gunzip on the fly

	Steve


[-- Attachment #2: unwrap --]
[-- Type: text/plain, Size: 576 bytes --]

#!/usr/bin/perl
# unwrap gzipped Plan9 wrap(8) format packages
# usage: unwrap pkg.9gz
#
# unpack-plan9.pl, v 11062000
# (c) Fabricio Chalub, chalub@gnu.org 

$pkg = $ARGV[0];

open F, "zcat $pkg |" or die "cannot open pipe: $!";

while (<F>)
{
    /(.*) (.*) (.*) (.*) (.*) (.*)/;
    $filename = $1;
    $filename = substr ($filename, 1);
    $length = $6;
    read F, $buffer, $length;
    print "$filename\n";
    if ($length == 0)
    {
	mkdir $filename, 0700;
    }
    else
    {
	open O, ">$filename";
	print O $buffer;
	close O;
    }
}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-06-16 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-12 10:29 [9fans] Utility to extract the plan9.9gz files Fabricio Chalub
2000-06-16 14:47 ` Steve Kotsopoulos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).