Re: shell script implementation of man

2008-12-23 Thread Alain M.
I believe this was sent to me by mistake, this is a thread of this list... Rob Landley escreveu: On Monday 22 December 2008 10:36:23 Alain M. wrote: Rob Landley escreveu: I think some kind of "meta busybox" project could be started which could accumulate people's knowledge in sense of

Re: shell script implementation of man

2008-12-23 Thread Rob Landley
On Monday 22 December 2008 10:36:23 Alain M. wrote: > Rob Landley escreveu: > >> I think some kind of "meta busybox" project could be started which could > >> accumulate people's knowledge in sense of supplement scripts and > >> configuration files used with busybox. > >> > >> What do you think? >

Re: shell script implementation of man

2008-12-22 Thread Alain M.
Rob Landley escreveu: >> >> I think some kind of "meta busybox" project could be started which could >> accumulate people's knowledge in sense of supplement scripts and >> configuration files used with busybox. >> >> What do you think? > > Can of worms. (Please don't try to turn BusyBox into a L

Re: shell script implementation of man

2008-12-20 Thread Rob Landley
On Sunday 30 November 2008 04:52:14 Vladimir Dronnikov wrote: > examples/* are way unstructured. I think it would be more useful to > maintain a sample root filesystem under examples/. Say, we now have acpid. > Then examples/etc/acpi/* should contain working scripts. So that people > could just cop

Re: shell script implementation of man

2008-11-30 Thread Vladimir Dronnikov
> On Wednesday 19 November 2008 15:26, Vladimir Dronnikov wrote: > > I think there is a bunch of such useful scripts. They are smaller than > their > > C implementation and are extremely useful. The question still exists > where > > to place them in the building tree? > > I guess examples/* would d

Re: shell script implementation of man

2008-11-29 Thread Denys Vlasenko
On Wednesday 19 November 2008 15:26, Vladimir Dronnikov wrote: > I think there is a bunch of such useful scripts. They are smaller than their > C implementation and are extremely useful. The question still exists where > to place them in the building tree? I guess examples/* would do. -- vda _

RE: shell script implementation of man

2008-11-24 Thread Cathey, Jim
>The other thing I wanted to mention was the possibility of extending >this little man script, or creating an alternate, so that it could look >up man pages from a single file to prevent a whole 1kb, 2kb, 4kb or w/e >sized inode from being used to hold a single 200 byte compressed ascii >man pa

Re: shell script implementation of man

2008-11-24 Thread walter harms
Matthew Hiles schrieb: > > Though I don't understand this line: >> "$CAT" "$pagefile" | "$PAGER" "$pagefile" > > Shouldn't that be?: > > "$CAT" "$pagefile" | "$PAGER" > 1. i did not test the script. it is a suggestion. > "$CAT" "$pagefile" | "$PAGER" that should expand to: bcat filename

Re: shell script implementation of man

2008-11-23 Thread Matthew Hiles
walter harms wrote: > just to provide an alternative way: > > case "$pagefile" in > *.bz2) > CAT="bzcat" ;; > *.gz) > CAT="zcat" ;; > *) > CAT="cat" ;; > esac > > "$CAT" "$pagefile" | "$PAGER" "$pagefile" > > this can easily be expanded to dot-whatever-you-like > >

Re: shell script implementation of man

2008-11-23 Thread walter harms
Cathey, Jim schrieb: >> case "$pagefile" in >> *.bz2) >>bzcat "$pagefile" | "$PAGER" ;; >> *.gz) >>zcat "$pagefile" | "$PAGER" ;; >> *) >>"$PAGER" "$pagefile" ;; >> esac >> >> paths= >> pagefile= >> pagearg= >> section= > > > If there is no further work (and I don't see

RE: shell script implementation of man

2008-11-21 Thread Cathey, Jim
>case "$pagefile" in >*.bz2) >bzcat "$pagefile" | "$PAGER" ;; >*.gz) >zcat "$pagefile" | "$PAGER" ;; >*) >"$PAGER" "$pagefile" ;; >esac > >paths= >pagefile= >pagearg= >section= If there is no further work (and I don't see any), is it not appropriate to "exec" the last step

Re: shell script implementation of man

2008-11-21 Thread Matthew Hiles
On Fri, Nov 21, 2008 at 2:29 AM, Natanael Copa <[EMAIL PROTECTED]> wrote: > On Wed, 2008-11-19 at 12:54 -0500, Matthew Hiles wrote: > >> [ -z $PAGER ] && PAGER=less > > you need quotes: > > [ -z "$PAGER" ] && PAGER=less > > >> #okay, found the page, try decompressing and displaying >> case $pagefil

Re: shell script implementation of man

2008-11-20 Thread Natanael Copa
On Wed, 2008-11-19 at 12:54 -0500, Matthew Hiles wrote: > [ -z $PAGER ] && PAGER=less you need quotes: [ -z "$PAGER" ] && PAGER=less > #okay, found the page, try decompressing and displaying > case $pagefile in > *.bz2) >bzcat $pagefile | $PAGER ;; > *.gz) >zcat $pagefile | $PA

Re: shell script implementation of man

2008-11-19 Thread Matthew Hiles
On Wed, Nov 19, 2008 at 1:11 PM, Cathey, Jim <[EMAIL PROTECTED]> wrote: > One more optimization it needs, it should check > to see that stdout is a tty and only run the > pager if it is, else cat. ("man foo >foofile") > -- Jim hm.. well the easiest way to code this in is to add a line after the l

Re: shell script implementation of man

2008-11-19 Thread Paul Smith
On Wed, 2008-11-19 at 19:12 +0100, Yann E. MORIN wrote: > What makes you say it's /far more portable than $()/ ? Just because there are still shells out there that don't implement $() (msh in busybox is one example, but also IIRC the Solaris /bin/sh falls into this category).

RE: shell script implementation of man

2008-11-19 Thread Cathey, Jim
>What makes you say it's /far more portable than $()/ ? >Is that because $() was introduced after `` (if so is the case)? It is the case. Every shell I've ever heard of does ``, the $() thing showed up with the Korn shell and got propagated into various other shells. I believe `` is more widely

Re: shell script implementation of man

2008-11-19 Thread Yann E. MORIN
Paul, All, On Wednesday 19 November 2008 18:28:33 Paul Smith wrote: > On Wed, 2008-11-19 at 18:01 +0100, Yann E. MORIN wrote: > > Do not forget that back-ticks are not POSIX, while $() is. > Uh... what?!?! That's absolutely not true. Backticks are > unquestionably defined in the POSIX sh definit

RE: shell script implementation of man

2008-11-19 Thread Cathey, Jim
>if someone were lacking less and more they can just set PAGER to >cat a viola, lots of scrolling. With viola you get lots of screeching! :-) You can even have a PAGER-less run find its own hierarchy of less/more/cat for them, et voila, perfect script! One more optimization it needs, it should

Re: shell script implementation of man

2008-11-19 Thread Matthew Hiles
On Wed, Nov 19, 2008 at 12:13 PM, Cathey, Jim <[EMAIL PROTECTED]> wrote: > I believe it is customary to use an environment > variable PAGER to allow overriding of less (or > more, or whatever the system default is). In ksh-speak: > > case $pagefile in > *.bz2) >bzcat $pagefile | ${PAGER:-

Re: shell script implementation of man

2008-11-19 Thread Paul Smith
On Wed, 2008-11-19 at 18:01 +0100, Yann E. MORIN wrote: > Do not forget that back-ticks are not POSIX, while $() is. Uh... what?!?! That's absolutely not true. Backticks are unquestionably defined in the POSIX sh definition. They are not marked as "old" or "deprecated" or anything similar. It'

Re: shell script implementation of man

2008-11-19 Thread Yann E. MORIN
Hello Matthew! Hello all! On Wednesday 19 November 2008 16:58:15 Matthew Hiles wrote: > msh does not appear to support > $() style command substitution, it does support backticks. I've > changed the script and it appears to work with msh without any issues. Do not forget that back-ticks are not P

RE: shell script implementation of man

2008-11-19 Thread Cathey, Jim
I believe it is customary to use an environment variable PAGER to allow overriding of less (or more, or whatever the system default is). In ksh-speak: case $pagefile in *.bz2) bzcat $pagefile | ${PAGER:-less} ;; *.gz) zcat $pagefile | ${PAGER:-less} ;; *) ${PAGER:-less} $p

Re: shell script implementation of man

2008-11-19 Thread Matthew Hiles
On Wed, Nov 19, 2008 at 12:01 PM, Yann E. MORIN <[EMAIL PROTECTED]> wrote: > Hello Matthew! > Hello all! > > On Wednesday 19 November 2008 16:58:15 Matthew Hiles wrote: >> msh does not appear to support >> $() style command substitution, it does support backticks. I've >> changed the script and it

Re: shell script implementation of man

2008-11-19 Thread Matthew Hiles
I'll address all the replies at once. > I assume that you did not see miscutils/man.c, i fear. It appears man.c is for nroff files. This is a smaller, simpler implementation meant to answer the request in the TODO. :D > Did you test this with msh ? The first version I posted, I did not. msh

Re: shell script implementation of man

2008-11-19 Thread Bernhard Reutner-Fischer
On Wed, Nov 19, 2008 at 09:15:51AM -0500, Matthew Hiles wrote: >So I saw this in the TODO file: > >>man >> It would be nice to have a man command. Not one that handles troff or >> anything, just one that can handle preformatted ascii man pages, possibly >> compressed. This could probably be a

Re: shell script implementation of man

2008-11-19 Thread Vladimir Dronnikov
I think there is a bunch of such useful scripts. They are smaller than their C implementation and are extremely useful. The question still exists where to place them in the building tree? Regards, -- Vladimir ___ busybox mailing list busybox@busybox.net

Re: shell script implementation of man

2008-11-19 Thread Loïc Grenié
2008/11/19, Matthew Hiles <[EMAIL PROTECTED]>: > So I saw this in the TODO file: > > >man > > It would be nice to have a man command. Not one that handles troff or > > anything, just one that can handle preformatted ascii man pages, possibly > > compressed. This could probably be a script