[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#8111: less package doesn't include LESSOPEN support (was Re: Warning!! PAGER=zless)



On Mon, 17 Mar 1997, Chris Fearnley wrote:

> > Note that the order of the case statements is important...e.g. if
> > you don't have 'tar' before 'gz' then the gz line will "catch"
> > .tar.gz files and you wont get a listing.
>
> I'm not sure about this design.

The "design", if i recall correctly, is straight out of the less
documentation.

> There could exist gzip files that don't have .gz endings and so on. I
> think a better approach is to use file(1) (and gzip?) to do this.

yep. using file would be a much better way of doing it. However,
my script is a quick hack that works, and it's dead simple to
enhance...just add a new "case) actions ;;" line.

One-Of-These-Days<tm> I might get around to modifying it to use file.
perhaps something like:

    #!/bin/sh

    filetype=`file $1`

    case "$filetype" in
        whatever) do_something ;;
        "*Debian binary package*") dpkg -I $1 ; dpkg -c $1  2>/dev/null ;;
    esac

actually, I'd rewrite it in perl if i did that..it would get real ugly
real fast in sh.


> And I sometimes like to pipe .gz files into less.

piping files into less still works as normal.  I do it all the time.

> Another bug in your script is that it doesn't support uncompressing
> multiple files and saving marks in each of them and hoping back and
> forth easily.

have you actually tried my script? I just tried to do exactly this and
it worked with no problems (cd /usr/doc/gzip ; less * ; scroll down a
bit ; set mark ; :n for next file a few times setting marks in random
places ; jump back to marks with ' key)

I originally wrote the script because I was sick of the way zless
behaved when given multiple filename arguments. I specifically wrote it
to make browsing /usr/doc subdirectories easier. 

In other words it was written for the sole reason of doing exactly what
you say it won't do.

I added the .tar.gz & .deb stuff because it was simple to do so - i
hardly ever use those features because i usually dont remember to...i'm
too used to typing stuff like 'dpkg -c foo.deb | less'

> Maybe someone can merge your approach with mine :) Maybe the less
> maintainer is getting into trouble accepting the job of adding this
> enhancement. Might I suggest putting some examples in /usr/doc/less?
>
> BTW, you don't need the | in your ENV variables.

yep, i know.  i prefer to use pipes rather than temporary files.

Craig


Reply to: