diff options
author | alfred <alfred@FreeBSD.org> | 2000-06-27 22:41:12 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2000-06-27 22:41:12 +0000 |
commit | ea961c73cbbffe4ff9c795ce62223d4634aaf384 (patch) | |
tree | d1d5e21bf74d29896178b20ebe9fb79e5cdb7ae9 /sys/pci/locate.pl | |
parent | 688747516283066539a75b7e4c858de3a26e1424 (diff) | |
download | FreeBSD-src-ea961c73cbbffe4ff9c795ce62223d4634aaf384.zip FreeBSD-src-ea961c73cbbffe4ff9c795ce62223d4634aaf384.tar.gz |
use warnings
use strict
add 'usage'
Diffstat (limited to 'sys/pci/locate.pl')
-rwxr-xr-x | sys/pci/locate.pl | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/sys/pci/locate.pl b/sys/pci/locate.pl index 1cb45ad..89688e1 100755 --- a/sys/pci/locate.pl +++ b/sys/pci/locate.pl @@ -1,8 +1,21 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w # $FreeBSD$ -$errpos = hex($ARGV[0])/4; -$ofs=0; +use strict; + +if (!defined($ARGV[0])) { + print( +" +Perl script to convert NCR script address into label+offset. +Useful to find the failed NCR instruction ... + +usage: $0 <address> +"); + exit(1); +} + +my $errpos = hex($ARGV[0])/4; +my $ofs=0; open (INPUT, "cc -E ncr.c 2>/dev/null |"); @@ -14,9 +27,9 @@ while ($_ = <INPUT>) while ($_ = <INPUT>) { last if /^\}\;/; - ($label, $size) = /ncrcmd\s+(\S+)\s+\[([^]]+)/; + my ($label, $size) = /ncrcmd\s+(\S+)\s+\[([^]]+)/; $size = eval($size); - if ($label) { + if (defined($label) && $label) { if ($errpos) { if ($ofs + $size > $errpos) { printf ("%4x: %s\n", $ofs * 4, $label); |