Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/sys/src/cmd/perl/lib/B/assemble

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


use B::Assembler qw(assemble_fh);
use FileHandle;

my ($filename, $fh, $out);

if ($ARGV[0] eq "-d") {
    B::Assembler::debug(1);
    shift;
}

$out = \*STDOUT;

if (@ARGV == 0) {
    $fh = \*STDIN;
    $filename = "-";
} elsif (@ARGV == 1) {
    $filename = $ARGV[0];
    $fh = new FileHandle "<$filename";
} elsif (@ARGV == 2) {
    $filename = $ARGV[0];
    $fh = new FileHandle "<$filename";
    $out = new FileHandle ">$ARGV[1]";
} else {
    die "Usage: assemble [filename] [outfilename]\n";
}

binmode $out;
$SIG{__WARN__} = sub { warn "$filename:@_" };
$SIG{__DIE__} = sub { die "$filename: @_" };
assemble_fh($fh, sub { print $out @_ });

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.