X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=klibc%2Fklibc%2Fmakeerrlist.pl;h=14498d880a9e29603bf8ef39394fc5a0b88558a8;hp=121ed1f46b97ebdaf8e16e8eb64679086c5bfbfe;hb=54eb6a122fc6d2d765b9f71f9b47d529c1acf30f;hpb=a41a0e28c2ba0abf99b5e7ea17645ae0e4f05758 diff --git a/klibc/klibc/makeerrlist.pl b/klibc/klibc/makeerrlist.pl index 121ed1f46..14498d880 100644 --- a/klibc/klibc/makeerrlist.pl +++ b/klibc/klibc/makeerrlist.pl @@ -10,20 +10,27 @@ use FileHandle; %errors = (); %errmsg = (); $maxerr = -1; -$rootdir = 'linux/include/'; # Must have trailing / +@includelist = (); # Include directories sub parse_file($) { my($file) = @_; my($fh) = new FileHandle; my($line, $error, $msg); my($kernelonly) = 0; + my($root); - $file = $rootdir.$file; + print STDERR "opening $file\n" unless ( $quiet ); - print STDERR "opening $file\n"; + $ok = 0; + foreach $root ( @includelist ) { + if ( $fh->open($root.'//'.$file, '<') ) { + $ok = 1; + last; + } + } - if ( !($fh->open("< ".$file)) ) { - die "$0: cannot open $file\n"; + if ( ! $ok ) { + die "$0: Cannot find file $file\n"; } while ( defined($line = <$fh>) ) { @@ -38,7 +45,7 @@ sub parse_file($) { $error = $1; $errno = $2+0; $msg = $3; - print STDERR "$error ($errno) => \"$msg\"\n"; + print STDERR "$error ($errno) => \"$msg\"\n" unless ( $quiet ); $errors{$errno} = $error; $errmsg{$errno} = $msg; $maxerr = $errno if ( $errno > $maxerr ); @@ -50,12 +57,25 @@ sub parse_file($) { } } close($fh); - print STDERR "closing $file\n"; + print STDERR "closing $file\n" unless ( $quiet ); } -parse_file('linux/errno.h'); +$v = $ENV{'KBUILD_VERBOSE'}; +$quiet = defined($v) ? !$v : 0; -($type) = @ARGV; +foreach $arg ( @ARGV ) { + if ( $arg eq '-q' ) { + $quiet = 1; + } elsif ( $arg =~ /^-(errlist|errnos|maxerr)$/ ) { + $type = $arg; + } elsif ( $arg =~ '^\-I' ) { + push(@includelist, "$'"); + } else { + die "$0: Unknown option: $arg\n"; + } +} + +parse_file('linux/errno.h'); if ( $type eq '-errlist' ) { print "#include \n";