* mailcheck patch
@ 1996-05-24 18:18 Anthony Heading
1996-05-27 17:06 ` Zoltan Hidvegi
0 siblings, 1 reply; 5+ messages in thread
From: Anthony Heading @ 1996-05-24 18:18 UTC (permalink / raw)
To: zsh-workers
I've had this patch kicking around for a year or two, and find it quite
useful. Perhaps it might be worth incorporating?
Anthony
*** Src/utils.c.orig Mon May 20 13:40:01 1996
--- Src/utils.c Thu May 23 18:30:23 1996
***************
*** 692,697 ****
--- 692,705 ----
if (!u) {
fprintf(stderr, "You have new mail.\n");
fflush(stderr);
+ } else if (*u == '?') {
+ List list;
+ if ((list = getshfunc(u+1))) {
+ LinkList args = newlinklist();
+ addlinknode(args, dupstring(u+1));
+ addlinknode(args, dupstring(*s));
+ doshfunc(list, args, 0, 0);
+ }
} else {
char *z = u;
*** Doc/zshparam.1.orig Fri May 24 19:03:48 1996
--- Doc/zshparam.1 Fri May 24 19:13:00 1996
***************
*** 397,409 ****
.TP
.B mailpath (MAILPATH)
An array (colon-separated list)
! of filenames to check for new mail. Each filename can
! be followed by a ? and a message that will be printed.
! The sequence $_ in the message will be replaced by the name
! of the mail file.
! The default message is "You have new mail." If an element is a directory
! instead of a file the shell will recursively check every file in every
! subdirectory of the element.
.TP
.B manpath (MANPATH)
An array (colon-separated list)
--- 397,410 ----
.TP
.B mailpath (MAILPATH)
An array (colon-separated list)
! of filenames to check for new mail. Each filename may
! be followed by `?' and a message to be printed:
! the sequence `$_' in the message will be replaced by the name
! of the mail file. The default message is "You have new mail."
! Alternatively, the filename may be followed by `??' and a shell
! function to be called with the mail file name as an argument.
! If an element is a directory instead of a file the shell will
! recursively check every file in every subdirectory of the element.
.TP
.B manpath (MANPATH)
An array (colon-separated list)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mailcheck patch
1996-05-24 18:18 mailcheck patch Anthony Heading
@ 1996-05-27 17:06 ` Zoltan Hidvegi
1996-05-27 20:04 ` Anthony Heading
0 siblings, 1 reply; 5+ messages in thread
From: Zoltan Hidvegi @ 1996-05-27 17:06 UTC (permalink / raw)
To: Anthony Heading; +Cc: zsh-workers
[-- Attachment #1: Type: application/pgp, Size: 3294 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mailcheck patch
1996-05-27 17:06 ` Zoltan Hidvegi
@ 1996-05-27 20:04 ` Anthony Heading
1996-05-27 21:45 ` Zefram
1996-05-27 22:00 ` Zoltan Hidvegi
0 siblings, 2 replies; 5+ messages in thread
From: Anthony Heading @ 1996-05-27 20:04 UTC (permalink / raw)
To: Zoltan Hidvegi; +Cc: heading_anthony, zsh-workers
Zoltan wrote:
> I do not incorporate it now. Instead here is an other patch. After that,
> the message part of mailpath will undergo parameter expansion, command
> substitution and arithmetic substitution. This is exactly what ksh does.
> This can provide equivalent functionality to the requested feature.
Fine by me. Just to check, though, is it clear that $_ will never clash with
its normal "special parameter" meaning?
Anthony
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mailcheck patch
1996-05-27 20:04 ` Anthony Heading
@ 1996-05-27 21:45 ` Zefram
1996-05-27 22:00 ` Zoltan Hidvegi
1 sibling, 0 replies; 5+ messages in thread
From: Zefram @ 1996-05-27 21:45 UTC (permalink / raw)
To: Anthony Heading; +Cc: hzoli, heading_anthony, zsh-workers
>Fine by me. Just to check, though, is it clear that $_ will never clash with
>its normal "special parameter" meaning?
The patch achieves the mail file meaning of $_ by temporarily replacing
the value of the parameter $_ with the name of the mail file. You
can't get at the previous value.
-zefram
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mailcheck patch
1996-05-27 20:04 ` Anthony Heading
1996-05-27 21:45 ` Zefram
@ 1996-05-27 22:00 ` Zoltan Hidvegi
1 sibling, 0 replies; 5+ messages in thread
From: Zoltan Hidvegi @ 1996-05-27 22:00 UTC (permalink / raw)
To: Anthony Heading; +Cc: Zsh workers list
> Zoltan wrote:
> > I do not incorporate it now. Instead here is an other patch. After that,
> > the message part of mailpath will undergo parameter expansion, command
> > substitution and arithmetic substitution. This is exactly what ksh does.
> > This can provide equivalent functionality to the requested feature.
>
> Fine by me. Just to check, though, is it clear that $_ will never clash with
> its normal "special parameter" meaning?
During the substitution the $_ special parameter expands to the name of the
mail folder. The old value of $_ is saved before the expansion and
restored afterwards. In command substitutions only the first command can
use $_ this way but that is not a big limitation. Command substitutions
are evaluated after a fork() and the change in $_ does not affect the
parent process.
Zoltan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1996-05-27 22:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-24 18:18 mailcheck patch Anthony Heading
1996-05-27 17:06 ` Zoltan Hidvegi
1996-05-27 20:04 ` Anthony Heading
1996-05-27 21:45 ` Zefram
1996-05-27 22:00 ` Zoltan Hidvegi
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).