On Wed, 2002-01-23 00:12:07 -0800, Malcolm Box <mb...@us...>
wrote in message <E16...@us...>:
>
> Index: Lang.pm
> ===================================================================
> RCS file: /cvsroot/lxr/lxr/lib/LXR/Lang.pm,v
> retrieving revision 1.25
> retrieving revision 1.26
> diff -u -d -r1.25 -r1.26
> --- Lang.pm 2001/11/28 13:01:57 1.25
> +++ Lang.pm 2002/01/23 08:12:05 1.26
> @@ -40,7 +40,8 @@
>
> if (!defined $lang) {
> # Try to see if it's a script
> - $files->getfile($pathname, $release) =~ /^#!\s*(\S+)/s;
> + my $fh = $files->getfilehandle($pathname, $release);
> + $fh->getline =~ /^#!\s*(\S+)/s;
>
> my $shebang = $1;
Please, take Lang.pm and read some further lines. There, we fetch
a (possible) shell bang and test it against the occurence of "perl".
Bad.
Spoken C'ish, there's an array of structs in lxr.conf (sorry,
I'm not Perl-enabled...) containing language descriptions. This
includes some possible filename extensions which are almost
reasonable. Why don't we add a struct member called "interpreters"
containing a list of possible interpreters, if there's not a match
for the filename extension.
Lang.pm does this exceptional for Perl, I'd like to see this behavior
to be a bit more flexible by scanning over thise things there in
lxr.conf. There's no need for a perl script to end up in .pl, equally
there's no need for s shell script to end up in .sh. So why don't we
generally also test for a shell bang (if there's no extension)?
I don't think that this is hard to code, but I can't do it.
Alternatively, one could use output of the "file" command...
Any volunteers?
MfG, JBG
--
Jan-Benedict Glaw . jb...@lu... . +49-172-7608481
-- New APT-Proxy written in shell script --
http://lug-owl.de/~jbglaw/software/ap2/
|