Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
678 B

  1. use B::Assembler qw(assemble_fh);
  2. use FileHandle;
  3. my ($filename, $fh, $out);
  4. if ($ARGV[0] eq "-d") {
  5. B::Assembler::debug(1);
  6. shift;
  7. }
  8. $out = \*STDOUT;
  9. if (@ARGV == 0) {
  10. $fh = \*STDIN;
  11. $filename = "-";
  12. } elsif (@ARGV == 1) {
  13. $filename = $ARGV[0];
  14. $fh = new FileHandle "<$filename";
  15. } elsif (@ARGV == 2) {
  16. $filename = $ARGV[0];
  17. $fh = new FileHandle "<$filename";
  18. $out = new FileHandle ">$ARGV[1]";
  19. } else {
  20. die "Usage: assemble [filename] [outfilename]\n";
  21. }
  22. binmode $out;
  23. $SIG{__WARN__} = sub { warn "$filename:@_" };
  24. $SIG{__DIE__} = sub { die "$filename: @_" };
  25. assemble_fh($fh, sub { print $out @_ });