zsh-workers
 help / color / mirror / code / Atom feed
* "Watch" function?
@ 1995-10-10 19:53 daemonboy
  1995-10-10 20:07 ` Dave Sainty
  1995-10-18  5:24 ` Richard Coleman
  0 siblings, 2 replies; 5+ messages in thread
From: daemonboy @ 1995-10-10 19:53 UTC (permalink / raw)
  To: zsh-workers


I asked about this a *long* time ago, and heard nothing, so I'll forward the
idea again and see if it flies.

Instead of/in addition to being able to specify a format string for the
"watch" facility, how hard would it be to have a special function which, if
defined, would be called whenever the "watch" facility "saw" someone
login/logout?  (Akin to precmd(), periodic(), chpwd(), etc.)

My thought is to pop up a Perl/Tk window when someone logged in, rather than
just printing it in the xterm.

Does this sound do-able?  Would anyone even use it?  (Other than me, of
course.)

+-----------------------------------------------------------------------------+
| Michael Campbell - mcampbel@offenbach.sbi.com :: I speak only for myself :: |
| Send me mail w/subject "send me pgp key" for my public PGP key.             |
+-----------------------------------------------------------------------------+


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

* Re: "Watch" function?
  1995-10-10 19:53 "Watch" function? daemonboy
@ 1995-10-10 20:07 ` Dave Sainty
  1995-10-18  5:24 ` Richard Coleman
  1 sibling, 0 replies; 5+ messages in thread
From: Dave Sainty @ 1995-10-10 20:07 UTC (permalink / raw)
  To: zsh-workers

daemonboy writes:

> I asked about this a *long* time ago, and heard nothing, so I'll forward the
> idea again and see if it flies.
> 
> Instead of/in addition to being able to specify a format string for the
> "watch" facility, how hard would it be to have a special function which, if
> defined, would be called whenever the "watch" facility "saw" someone
> login/logout?  (Akin to precmd(), periodic(), chpwd(), etc.)

Yeah, I would probably use it....

> My thought is to pop up a Perl/Tk window when someone logged in, rather than
> just printing it in the xterm.

....I just wouldn't use it like that... :-) If you're simply going to
call a perl script with it, it would seem more sensible to write the
whole thing in perl, scan utmp or wtmp yourself.

But I would quite like to customise the messages more based on who
logged in/out from where....

Dave.


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

* Re: "Watch" function?
  1995-10-10 19:53 "Watch" function? daemonboy
  1995-10-10 20:07 ` Dave Sainty
@ 1995-10-18  5:24 ` Richard Coleman
  1995-10-18 12:26   ` Zoltan Hidvegi
  1995-10-18 12:50   ` Dave Sainty
  1 sibling, 2 replies; 5+ messages in thread
From: Richard Coleman @ 1995-10-18  5:24 UTC (permalink / raw)
  To: mcampbel; +Cc: zsh-workers

> I asked about this a *long* time ago, and heard nothing, so I'll forward the
> idea again and see if it flies.
> 
> Instead of/in addition to being able to specify a format string for the
> "watch" facility, how hard would it be to have a special function which, if
> defined, would be called whenever the "watch" facility "saw" someone
> login/logout?  (Akin to precmd(), periodic(), chpwd(), etc.)
> 
> My thought is to pop up a Perl/Tk window when someone logged in, rather than
> just printing it in the xterm.
> 
> Does this sound do-able?  Would anyone even use it?  (Other than me, of
> course.)

I meant to reply to this earlier but got sidetracked.  Having zsh execute
a shell function at this point is easy.  The hard part is passing all the
information that you can access in WATCHFMT to this shell function.  We
would probably have to create more special parameters to do this.  I'm
not sure if it is worth it.

Richard Coleman
coleman@math.gatech.edu


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

* Re: "Watch" function?
  1995-10-18  5:24 ` Richard Coleman
@ 1995-10-18 12:26   ` Zoltan Hidvegi
  1995-10-18 12:50   ` Dave Sainty
  1 sibling, 0 replies; 5+ messages in thread
From: Zoltan Hidvegi @ 1995-10-18 12:26 UTC (permalink / raw)
  To: Richard Coleman; +Cc: mcampbel, zsh-workers

Richard wrote:
> I meant to reply to this earlier but got sidetracked.  Having zsh execute
> a shell function at this point is easy.  The hard part is passing all the
> information that you can access in WATCHFMT to this shell function.  We
> would probably have to create more special parameters to do this.  I'm
> not sure if it is worth it.

We can pass these informations using positional parameters.

Zoltan


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

* Re: "Watch" function?
  1995-10-18  5:24 ` Richard Coleman
  1995-10-18 12:26   ` Zoltan Hidvegi
@ 1995-10-18 12:50   ` Dave Sainty
  1 sibling, 0 replies; 5+ messages in thread
From: Dave Sainty @ 1995-10-18 12:50 UTC (permalink / raw)
  To: zsh-workers; +Cc: dave

Richard Coleman writes:

> > Instead of/in addition to being able to specify a format string for the
> > "watch" facility, how hard would it be to have a special function which, if
> > defined, would be called whenever the "watch" facility "saw" someone
> > login/logout?  (Akin to precmd(), periodic(), chpwd(), etc.)
> 
> I meant to reply to this earlier but got sidetracked.  Having zsh execute
> a shell function at this point is easy.  The hard part is passing all the
> information that you can access in WATCHFMT to this shell function.  We
> would probably have to create more special parameters to do this.  I'm
> not sure if it is worth it.

I've been thinking about this too. The obvious solution is to pass the
data in in $1 etc, but this is perhaps a little ugly. Another
possibility is to define local variables for the duration of the call,
with meaningful names for the parameters being passed in. A little
nicer, although I never found "magically appearing variables" very
clean....

Perhaps a builtin to return system status. This probably sounds like
the most work, but it's perhaps (???) cleaner than the above
two... eg. The default "watch" function could simply contain:

echo "`zshstat user` has `zshstat action` on `zshstat tty` from
`zshstat host`" >&2

Or, for the sake of more efficient default functions:

zshstat %user has %action on %tty from %host >&2

This has the advantage of lazy evaluation of the information for
WATCHFMT, TIMEFMT, whatever, plus _naming_ the data, instead of
indexing the parameters, plus fitting cleanly in with how you expect
the shell to work (less magic), and gets rid of that purpose built
code in zsh to handle special cases like WATCHFMT, gets rid of a few
more special shell variables. All it adds is this bizarre builtin, the
behaviour of which needs to be decided...

Dave.


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

end of thread, other threads:[~1995-10-18 12:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-10-10 19:53 "Watch" function? daemonboy
1995-10-10 20:07 ` Dave Sainty
1995-10-18  5:24 ` Richard Coleman
1995-10-18 12:26   ` Zoltan Hidvegi
1995-10-18 12:50   ` Dave Sainty

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).