From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3931 invoked from network); 5 May 2000 08:48:05 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 5 May 2000 08:48:05 -0000 Received: (qmail 23971 invoked by alias); 5 May 2000 08:47:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11177 Received: (qmail 23918 invoked from network); 5 May 2000 08:47:51 -0000 Date: Fri, 5 May 2000 10:47:43 +0200 (MET DST) Message-Id: <200005050847.KAA26165@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Andrej Borsenkow"'s message of Fri, 5 May 2000 12:23:59 +0400 Subject: RE: nslookup (function) problem Andrej Borsenkow wrote: > > - Does it use other environment variables? If so, which. In which > > order? I.e. which one overrides all others? > > - If $PAGER is not set, does it use a default pager or does it just > > dump the help to the output? I.e. is it enough to locally unset > > PAGER in nslookup() or should we locally export PAGER=cat? > > > > Unsetting PAGER runs it through `more' (obviously, default - but this > PAGER story is not documented anywhere). Setting PAGER=cat does the > trick ... almost. The problem is, now the ability to page output is > lost. > > Hmm ... may be extend nslookup function in the same way (probably, using > style to turn it on/off)? If output has more lines than fit on screen, > run it through PAGER? I was thinking about the same when I asked... This adds the `pager' style. If set, it's value is used as the progrma to use for paging (and only then will paging be done at all). If the value is the empty string, it uses $PAGER or `more' if $PAGER is not set. Bye Sven Index: Functions/Misc/nslookup =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Misc/nslookup,v retrieving revision 1.1.1.9 diff -u -r1.1.1.9 nslookup --- Functions/Misc/nslookup 2000/03/10 01:01:03 1.1.1.9 +++ Functions/Misc/nslookup 2000/05/05 08:45:38 @@ -4,6 +4,8 @@ setopt localoptions localtraps completealiases local tmp line compcontext=nslookup curcontext='nslookup:::' pmpt +local pager opager="$PAGER" +typeset +g -x PAGER=cat zmodload -e zsh/zpty || zmodload -i zsh/zpty @@ -13,6 +15,8 @@ pmpt=() zstyle -s ':nslookup' prompt tmp && pmpt=(-p "$tmp") zstyle -s ':nslookup' rprompt tmp && pmpt=("$pmpt[@]" -r "$tmp") +zstyle -s ':nslookup' pager tmp && + [[ -z "$pager" ]] && pager="${opager:-more}" (( $#pmpt )) || pmpt=(-p '> ') zpty nslookup nslookup @@ -29,7 +33,11 @@ zpty -r nslookup line '* > ' - print -nr "$line" + if [[ -n "$pager" ]]; then + print -nr "$line" | "$pager" + else + print -nr "$line" + fi done zpty -w nslookup 'exit' -- Sven Wischnowsky wischnow@informatik.hu-berlin.de