zsh-users
 help / color / mirror / code / Atom feed
* Re: null commands...
       [not found] <no.id>
@ 1996-10-28 22:15 ` Geoff Wing
  0 siblings, 0 replies; 13+ messages in thread
From: Geoff Wing @ 1996-10-28 22:15 UTC (permalink / raw)
  To: zsh-users

I wrote:
:Zefram wrote:
::>A lot of programs out there use the system() command on this, which on
::>most machines does "sh" "-c" "arguments".  So people strcat() the filename/s
::>onto the end of the PAGER var and just system() it.
::... which fails horribly when the filename contains any mildly unusual
::characters.  Any program that uses this method is broken.
:
:If you did: sprintf(buf, "%s '%s'", PAGER, filename) , what unusual
:characters would affect it besides ' ?  And people could check for special
:characters, like ' ,  and quote them in filename.
:Anyway, there are other reasons for not using system()


BTW, Zefram,  it's hard to mail back to you if the mail gets sent back to
the sender:

The original message was received at Mon, 28 Oct 1996 12:03:57 GMT
from root@mail [137.205.224.93]

   ----- The following addresses have delivery notifications -----
"|exec /dcs/94/zefram/etc/procmail/filter.mail"  (unrecoverable error)
    (expanded from: <zefram@stone.dcs.warwick.ac.uk>)

   ----- Transcript of session follows -----
[... stuff deleted...]

554 "|exec /dcs/94/zefram/etc/procmail/filter.mail"... unknown mailer error 2

-- 
Geoff Wing [gwing@primenet.com.au]     PrimeNet - Internet Consultancy
  Web   : http://www.primenet.com.au/  Phone    : +61-3-9818 2977
  Mobile: 0412 162 441		       Facsimile: +61-3-9819 3788


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: null commands...
  1996-10-28 11:53         ` Geoff Wing
  1996-10-28 12:20           ` Hrvoje Niksic
@ 1996-10-28 13:37           ` Zefram
  1 sibling, 0 replies; 13+ messages in thread
From: Zefram @ 1996-10-28 13:37 UTC (permalink / raw)
  To: Geoff Wing; +Cc: hniksic, gwing, tsv, zsh-users

>A lot of programs out there use the system() command on this, which on
>most machines does "sh" "-c" "arguments".  So people strcat() the filename/s
>onto the end of the PAGER var and just system() it.

... which fails horribly when the filename contains any mildly unusual
characters.  Any program that uses this method is broken.

-zefram


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: null commands...
  1996-10-28 11:53         ` Geoff Wing
@ 1996-10-28 12:20           ` Hrvoje Niksic
  1996-10-28 13:37           ` Zefram
  1 sibling, 0 replies; 13+ messages in thread
From: Hrvoje Niksic @ 1996-10-28 12:20 UTC (permalink / raw)
  To: Geoff Wing; +Cc: zefram, tsv, zsh-users

Geoff Wing (gwing@primenet.com.au) wrote:
> :empty) by default.  Then, if READNULLCMD is empty, zsh should use
> :${PAGER:-more} for < file shorthands.  If not, it should use whatever
> :is found in READNULLCMD.  How does that sound?
> I don't agree that READNULLCMD should default to any value in PAGER if one
> exists.  However, what might be nicer is:
[... description ...]

As far as I see, it is exactly the same thing I proposed.

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
* Q: What is an experienced Emacs user?
* A: A person who wishes that the terminal had pedals.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: null commands...
  1996-10-26 15:11       ` Hrvoje Niksic
  1996-10-26 18:33         ` Vincent Lefevre
@ 1996-10-28 11:53         ` Geoff Wing
  1996-10-28 12:20           ` Hrvoje Niksic
  1996-10-28 13:37           ` Zefram
  1 sibling, 2 replies; 13+ messages in thread
From: Geoff Wing @ 1996-10-28 11:53 UTC (permalink / raw)
  To: Hrvoje Niksic; +Cc: zefram, gwing, tsv, zsh-users

Hrvoje Niksic wrote:
:Zefram (zefram@dcs.warwick.ac.uk) wrote:
:> >But it would be a good idea to set READNULLCMD to value of $PAGER by
:> >default, wouldn't it?
:> Do you set $PAGER before invoking zsh?  I don't.
:
:Sorry, this one is obviously wrong.  READNULLCMD should be unset (or
:empty) by default.  Then, if READNULLCMD is empty, zsh should use
:${PAGER:-more} for < file shorthands.  If not, it should use whatever
:is found in READNULLCMD.  How does that sound?

The current behaviour for READNULLCMD is:  it is originally set to `more'.
If it is unset, then the value in NULLCMD is used, which is normally `cat'
(unless you are trying to emulate sh/ksh/csh).

I don't agree that READNULLCMD should default to any value in PAGER if one
exists.  However, what might be nicer is:
if READNULLCMD
  use READNULLCMD
else if PAGER		/____  this is only change to
  use PAGER		\      the current system.
else if NULLCMD
  use NULLCMD
else
  echo "zsh: redirection with no command"

It might be nice to have READNULLCMD parse or pass arguments, but
I, myself, probably won't use it.


In another message, Zefram wrote:
:No.  Arguments in $PAGER might or might not work, depending on the
:program interpreting it.  (I am of the opinion that they should not
:work.)

A lot of programs out there use the system() command on this, which on
most machines does "sh" "-c" "arguments".  So people strcat() the filename/s
onto the end of the PAGER var and just system() it.  (Of course, a lot of
other people think you should never use the system() call, but let's NOT get
into that debate).
Of course, given that this is internal to the shell, it would be ludicrous 
for us to use system().  I'm just stating how other people use it.
-- 
Geoff Wing [gwing@primenet.com.au]     PrimeNet - Internet Consultancy
  Web   : http://www.primenet.com.au/  Phone    : +61-3-9818 2977
  Mobile: 0412 162 441		       Facsimile: +61-3-9819 3788


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: null commands...
  1996-10-26 18:33         ` Vincent Lefevre
  1996-10-26 19:01           ` Hrvoje Niksic
@ 1996-10-26 19:18           ` Zefram
  1 sibling, 0 replies; 13+ messages in thread
From: Zefram @ 1996-10-26 19:18 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: zsh-users

>This wouldn't always work. $PAGER may have arguments, e.g. "less -is".
>But $READNULLCMD can't:
>Is it a bug?

No.  Arguments in $PAGER might or might not work, depending on the
program interpreting it.  (I am of the opinion that they should not
work.)

It might be useful to allow $READNULLCMD to be an array, containing
arguments, through which *any* command could be executed using eval.
This obviously can't be done to $PAGER, so these should not be merged.

-zefram


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: null commands...
  1996-10-26 18:33         ` Vincent Lefevre
@ 1996-10-26 19:01           ` Hrvoje Niksic
  1996-10-26 19:18           ` Zefram
  1 sibling, 0 replies; 13+ messages in thread
From: Hrvoje Niksic @ 1996-10-26 19:01 UTC (permalink / raw)
  To: Vincent Lefevre; +Cc: zsh-users

Vincent Lefevre (vlefevre@ens-lyon.fr) wrote:
> This wouldn't always work. $PAGER may have arguments, e.g. "less -is".
> But $READNULLCMD can't:
[...]
> Is it a bug?

No, it's another gripe for READNULLCMD (regardless of $PAGER): It
should be parsed as command-line string.  So
< file
should be translated to
${=READNULLCMD} < file
instead of $READNULLCMD < file, which is currently the case.

With the $PAGER changes zsh would do the following:

If READNULLCMD is non-empty, `< file' means `${=READNULLCMD} < file',
else if PAGER is non-empty, `< file' means `${=PAGER} < file',
else `< file' means `more < file'.

I think this behaviour would be well-accepted by the users which
generally set PAGER to whatever they like (e.g. less or "less -i").
Would it be hard to code to exec.c?

-- 
} WWW:          World-Wide-Waste.  Waste management corporation, which
}               handles the billions of tons of garbage generated by just
}               about everybody these days.
} You owe the Oracle a good book.  In HyperText, please.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: null commands...
  1996-10-26 15:11       ` Hrvoje Niksic
@ 1996-10-26 18:33         ` Vincent Lefevre
  1996-10-26 19:01           ` Hrvoje Niksic
  1996-10-26 19:18           ` Zefram
  1996-10-28 11:53         ` Geoff Wing
  1 sibling, 2 replies; 13+ messages in thread
From: Vincent Lefevre @ 1996-10-26 18:33 UTC (permalink / raw)
  To: zsh-users

Hrvoje Niksic writes:
> Sorry, this one is obviously wrong.  READNULLCMD should be unset (or
> empty) by default.  Then, if READNULLCMD is empty, zsh should use
> ${PAGER:-more} for < file shorthands.  If not, it should use whatever
> is found in READNULLCMD.  How does that sound?

This wouldn't always work. $PAGER may have arguments, e.g. "less -is".
But $READNULLCMD can't:

Et encore? READNULLCMD="less -is"
Et encore? < file
zsh: command not found: less -is
zsh: exit 1     less -is < file

Is it a bug?

-- 
Vincent Lefevre, vlefevre@ens-lyon.fr | Acorn RiscPC600, 20+1MB RAM, Eagle M2
http://www.ens-lyon.fr/~vlefevre      | Apple CD-300, SyQuest 270MB
PhD in Computer Science, 1st year     | Atari Falcon030, 4MB RAM
------------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: null commands...
@ 1996-10-26 15:21 alain (a.) caron
  0 siblings, 0 replies; 13+ messages in thread
From: alain (a.) caron @ 1996-10-26 15:21 UTC (permalink / raw)
  To: zefram; +Cc: gwing, tsv, zsh-users

In message "Re: null commands...", 'zefram@dcs.warwick.ac.uk' writes:

>>But it would be a good idea to set READNULLCMD to value of $PAGER by
>>default, wouldn't it?
>
>Do you set $PAGER before invoking zsh?  I don't.
>
>-zefram
>

Maybe zsh should use PAGER instead of READNULLCMD if READNULLCMD is
not set.


Alain Caron
Nortel Technology, Montr?al, Qu?bec, Canada
email: alainc@nortel.ca
phone: 514-765-7718


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: null commands...
  1996-10-26 15:05     ` Zefram
@ 1996-10-26 15:11       ` Hrvoje Niksic
  1996-10-26 18:33         ` Vincent Lefevre
  1996-10-28 11:53         ` Geoff Wing
  0 siblings, 2 replies; 13+ messages in thread
From: Hrvoje Niksic @ 1996-10-26 15:11 UTC (permalink / raw)
  To: Zefram; +Cc: gwing, tsv, zsh-users

Zefram (zefram@dcs.warwick.ac.uk) wrote:
> >But it would be a good idea to set READNULLCMD to value of $PAGER by
> >default, wouldn't it?
> Do you set $PAGER before invoking zsh?  I don't.

Sorry, this one is obviously wrong.  READNULLCMD should be unset (or
empty) by default.  Then, if READNULLCMD is empty, zsh should use
${PAGER:-more} for < file shorthands.  If not, it should use whatever
is found in READNULLCMD.  How does that sound?

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
Contrary to popular belief, Unix is user friendly.  
It just happens to be selective about who it makes friends with.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: null commands...
  1996-10-26 14:21   ` Hrvoje Niksic
@ 1996-10-26 15:05     ` Zefram
  1996-10-26 15:11       ` Hrvoje Niksic
  0 siblings, 1 reply; 13+ messages in thread
From: Zefram @ 1996-10-26 15:05 UTC (permalink / raw)
  To: Hrvoje Niksic; +Cc: gwing, tsv, zsh-users

>But it would be a good idea to set READNULLCMD to value of $PAGER by
>default, wouldn't it?

Do you set $PAGER before invoking zsh?  I don't.

-zefram


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: null commands...
  1996-10-26  7:51 ` Geoff Wing
@ 1996-10-26 14:21   ` Hrvoje Niksic
  1996-10-26 15:05     ` Zefram
  0 siblings, 1 reply; 13+ messages in thread
From: Hrvoje Niksic @ 1996-10-26 14:21 UTC (permalink / raw)
  To: Geoff Wing; +Cc: tsv, zsh-users

Geoff Wing (gwing@primenet.com.au) wrote:
> Varadarajan wrote:
> :Zsh  allows a shorthand  "< file"  and treats  it as  "more < file". I
> :guess it  would  be better if $PAGER   is  used when set  rather  than
> :hardcoding it to more. Is there any reason to use more specifically?
> This is controlled by the variable: READNULLCMD
> The default for this variable is `more'.  Just set it to your favourite
> pager in one of your .z* files.

But it would be a good idea to set READNULLCMD to value of $PAGER by
default, wouldn't it?

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
The IDIOT.  Usually a cretin, morpohodite, or old COBOL programmer
selected to be the system administrator by a committee of cretins,
morphodites, and old COBOL programmers.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: null commands...
  1996-10-25 22:33 Varadarajan
@ 1996-10-26  7:51 ` Geoff Wing
  1996-10-26 14:21   ` Hrvoje Niksic
  0 siblings, 1 reply; 13+ messages in thread
From: Geoff Wing @ 1996-10-26  7:51 UTC (permalink / raw)
  To: tsv; +Cc: zsh-users

Varadarajan wrote:
:Zsh  allows a shorthand  "< file"  and treats  it as  "more < file". I
:guess it  would  be better if $PAGER   is  used when set  rather  than
:hardcoding it to more. Is there any reason to use more specifically?

This is controlled by the variable: READNULLCMD
The default for this variable is `more'.  Just set it to your favourite
pager in one of your .z* files.
-- 
Geoff Wing [gwing@primenet.com.au]   PrimeNet - Internet Consultancy
  Web: http://www.primenet.com.au/   Facsimile: +61-3-9819 3788


^ permalink raw reply	[flat|nested] 13+ messages in thread

* null commands...
@ 1996-10-25 22:33 Varadarajan
  1996-10-26  7:51 ` Geoff Wing
  0 siblings, 1 reply; 13+ messages in thread
From: Varadarajan @ 1996-10-25 22:33 UTC (permalink / raw)
  To: zsh-users


Zsh  allows a shorthand  "< file"  and treats  it as  "more < file". I
guess it  would  be better if $PAGER   is  used when set  rather  than
hardcoding it to more. Is there any reason to use more specifically?

Thanks for the wonderful shell,
Regards,
-- 
------------------------------------------------------------------------
Varadarajan.T.S.                E-Mail : tsv@cs.umanitoba.ca
#725, 77, University Crescent,  HTTP   : http://www.cs.umanitoba.ca/~tsv
Winnipeg,                       Tel No : 1-(204)269-6036(Residence)
Manitoba - MB R3T 3N8                    1-(204)474-8827(Office)
Canada.                        
------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~1996-10-28 22:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <no.id>
1996-10-28 22:15 ` null commands Geoff Wing
1996-10-26 15:21 alain (a.) caron
  -- strict thread matches above, loose matches on Subject: below --
1996-10-25 22:33 Varadarajan
1996-10-26  7:51 ` Geoff Wing
1996-10-26 14:21   ` Hrvoje Niksic
1996-10-26 15:05     ` Zefram
1996-10-26 15:11       ` Hrvoje Niksic
1996-10-26 18:33         ` Vincent Lefevre
1996-10-26 19:01           ` Hrvoje Niksic
1996-10-26 19:18           ` Zefram
1996-10-28 11:53         ` Geoff Wing
1996-10-28 12:20           ` Hrvoje Niksic
1996-10-28 13:37           ` Zefram

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).