Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / man / man1 / tknewsbiff.1
CommitLineData
920dae64
AT
1.TH TKNEWSBIFF 1 "1 January 1994"
2.SH NAME
3tknewsbiff \- pop up a window when news appears
4.SH SYNOPSIS
5.B tknewsbiff
6[
7.I server or config-file
8]
9.br
10.SH INTRODUCTION
11.B tknewsbiff
12pops up a window when there is unread news in your favorite newsgroups
13and removes the window after you've read the news. tknewsbiff can
14optionally play a sound, start your newsreader, etc.
15
16.SH SELECTING NEWSGROUPS
17
18By default, the configuration file ~/.tknewsbiff describes how
19tknewsbiff behaves. The syntax observes the usual Tcl rules
20- however, even if you don't know Tcl, all but the most esoteric
21configurations will be obvious.
22
23Each newsgroup (or set of newsgroups) to be watched is described by
24using the "watch" command. For example:
25
26.nf
27
28watch dc.dining
29watch nist.*
30watch comp.unix.wizard -threshold 3
31watch *.sources.* -threshold 20
32
33.fi
34
35For each newsgroup pattern, any newsgroup that matches it and which
36you are subscribed to (according to your newsrc file) is eligible for
37reporting. By default, tknewsbiff reports on the newsgroup if there
38is at least one unread article. The "-threshold" flag changes the
39threshold to the following number. For example, "-threshold 3" means
40there must be at least three articles unread before tknewsbiff will
41report the newsgroup.
42
43If no watch commands are given (or no configuration file exists), all
44groups which are subscribed to are watched.
45
46To suppress newsgroups that would otherwise be reported, use the
47"ignore" command. For example, the following matches all comp.* and
48nist.* newgroups except for nist.posix or .d (discussion) groups:
49
50.nf
51
52watch comp.*
53watch nist.*
54ignore nist.posix.*
55ignore *.d
56
57.fi
58
59The flag "-new" describes a command to be executed when the newsgroup
60is first reported as having unread news. For example, the following
61lines invoke the UNIX command "play" to play a sound.
62
63.nf
64
65watch dc.dining -new "exec play /usr/local/sounds/yumyum.au"
66watch rec.auto* -new "exec play /usr/local/sounds/vroom.au"
67
68.fi
69
70You can cut down on the verbosity of actions by defining procedures.
71For example, if you have many -new flags that all play sound files,
72you could define a sound procedure. This would allow the -new
73specification to be much shorter.
74
75.nf
76
77proc play {sound} {
78 exec play /usr/local/sounds/$sound.au
79}
80
81watch dc.dining -new "play yumyum"
82watch rec.auto* -new "play vroom"
83
84.fi
85
86As an aside, you can put an "&" at the end of an "exec" command to get
87commands to execute asynchronously. However, it's probably not a good
88idea to do this when playing sound files anyway.
89
90"newsgroup" is a read-only variable which contains the name of the
91newsgroup that is being reported. This is useful when the action is
92triggered by a pattern. For example, the following line could run the
93newsgroup name through a speech synthesizer:
94
95.nf
96
97watch * -new {
98 exec play herald.au
99 exec speak "New news has arrived in $newsgroup."
100}
101
102.fi
103
104The flag "\-display" describes a command to be executed every time the
105newsgroup is reported as having unread news. The special command
106"display" is the default command. It schedules $newsgroup to be
107written to tknewsbiff's display when it is rewritten. For example, by
108explicitly providing a -display flag that omits the display command,
109you can disable the display of newsgroups that are already reported
110via -new.
111
112.nf
113
114watch dc.dining -new {exec play yumyum.au} -display {}
115
116.fi
117
118If you want to execute an action repeatedly and
119.I still
120display the newsgroup in the default manner,
121explicitly invoke the display command via the -display flag. For example:
122
123.nf
124
125watch *security* -display {
126 exec play red-alert.au
127 display
128}
129
130.fi
131
132Actions associated with the -new and -display flags are executed only
133once for each matching newsgroup. The command executed is the one
134associated with the first pattern in the configuration file that
135matches and observes the given threshold.
136
137Any command that is simply listed in the configuration file is
138executed each time before the update loop in tknewsbiff. The reserved
139(but user-defined) procedure "user" is run immediately after the
140newsgroups are scheduled to be written to the display and before they
141are actually written.
142
143For example, suppose unread articles appear in several rec.auto groups
144and you play the same sound for each one. To prevent playing the
145sound several times in a row, make the -new command simply set a flag.
146In the user procedure, play the sound if the flag is set (and then
147reset the flag).
148
149The user procedure could also be used to start a newsreader. This
150would avoid the possibility of starting multiple newsreaders just
151because multiple newsgroups contained unread articles. (A check
152should, of course, be made to make sure that a newsreader is not
153already running.)
154
155.SH MORE VARIABLES
156
157The following example lines show variables that can affect the
158behavior of tknewsbiff
159
160.nf
161
162set delay 120
163set server news.nist.gov
164set server_timeout 60
165set newsrc ~/.newsrc
166set width 40
167set height 20
168set active_file /usr/news/lib/active
169
170.fi
171
172tknewsbiff alternates between checking for unread news and
173sleeping (kind of like many undergraduates). The "delay" variable
174describes how many seconds to sleep.
175
176The "server" variable names an NNTP news-server.
177The default is "news". The "server" variable is
178only used if the "active_file" variable is not set.
179
180The "server_timeout" variable describes how how many seconds to wait
181for a response from the server before giving up. -1 means wait
182forever or until the server itself times out. The default is 60
183seconds.
184
185The "newsrc" variable describes the name of your .newsrc file. By
186default, tknewsbiff looks in your home directory for a newsrc file. A
187server-specific newsrc is used if found. For example, if you have set
188server to "cubit.nist.gov", then tknewsbiff looks for
189~/.newsrc-cubit.nist.gov. (This is the Emacs gnus convention - which
190is very convenient when you read news from multiple servers.) If
191there is no server-specific newsrc, tknewsbiff uses ~/.newsrc.
192
193The "width" variable describes the width that tknewsbiff will use to
194display information. If any newsgroup names are long enough, they
195will be truncated so that the article counts can still be shown. You
196can manually resize the window to see what was truncated. However, if
197your configuration file sets the width variable, the window will be
198restored to that size the next time that tknewsbiff checks for unread
199news and updates its display.
200
201The "height" variable describes the maximum height that tknewsbiff
202will use to display information. If fewer newsgroups are reported,
203tknewsbiff will shrink the window appropriately. You can manually
204resize the window but if your configuration file sets the height
205variable, the window will be restored to that size the next time that
206tknewsbiff checks for unread news and updates its display.
207
208The "active_file" variable describes the name of the news active file.
209If set, the active file is read directly in preference to using NNTP
210(even if the "server" variable is set). This is particularly useful
211for testing out new configuration files since you can edit a fake
212active file and then click button 2 to immediately see how tknewsbiff
213responds (see BUTTONS below).
214
215If the environment variable DOTDIR is set, then its value is used as a
216directory in which to find all dotfiles instead of from the home
217directory. In particular, this affects the tknewsbiff configuration
218file and the .newsrc file (assuming the newsrc variable is not set
219explicitly).
220
221.SH WATCHING DIFFERENT NEWS SERVERS
222
223To watch multiple servers, run tknewsbiff multiple times. (Since you
224need different .newsrc files and the servers have different newsgroups
225and article numbers anyway, there is no point in trying to do this in
226a single process.)
227
228You can point tknewsbiff at a different server with an appropriate
229argument. The argument is tried both as a configuration file name and
230as a suffix to the string "~/.tknewsbiff-". So if you want to watch
231the server "kidney", store the tknewsbiff configuration information in
232~/.tknewsbiff-kidney". The following two commands will both use that
233configuration file.
234
235.nf
236
237 tknewsbiff kidney
238 tknewsbiff ~/.tknewsbiff-kidney
239
240.fi
241
242In both cases, the actual server to contact is set by the value of the
243server variable in the configuration file.
244
245If no configuration file is found, the argument is used as the server
246to contact. This allows tknewsbiff to be run with no preparation
247whatsoever.
248
249If the argument is the special keyword "active" (or ends in
250"/active"), it is used as the name of an active file. This is in turn
251used to initialize the variable "active_file" so that tknewsbiff reads
252from the active file directly rather than using NNTP.
253
254Creating your own active file is a convenient way of testing your
255configuration file. For example, after running the following command,
256you can repeatedly edit your active file and trigger the update-now
257command (either by pressing button 2 or setting the delay variable
258very low) to see how tknewsbiff responds.
259
260The active file must follow the format of a real active file. The
261format is one newsgroup per line. After the newsgroup name is the
262number of the highest article, the lowest article. Lastly is the
263letter y or m. m means the newsgroup is moderated. y means posting
264is allowed.
265
266.SH WINDOW
267
268When unread news is found, a window is popped up. The window lists
269the names of the newsgroups and the number of unread articles in each
270(unless suppressed by the -display flag). When there is no longer any
271unread news, the window disappears (although the process continues to
272run).
273
274.SH BUTTONS
275
276Button or key bindings may be assigned by bind commands. Feel free to
277change them. The default bind commands are:
278
279.nf
280
281bind .list <1> help
282bind .list <2> update-now
283bind .list <3> unmapwindow
284
285.fi
286
287By default button 1 (left) is bound to "help". The help command
288causes tknewsbiff to pop up a help window.
289
290By default, button 2 (middle) is bound to "update-now". The update-now
291command causes tknewsbiff to immediately check for unread news. If
292your news server is slow or maintains a very large number of
293newsgroups, or you have a large number of patterns in your
294configuration file, tknewsbiff can take considerable time before
295actually updating the window.
296
297By default, button 3 (right) is bound to "unmapwindow". The
298unmapwindow command causes tknewsbiff to remove the window from the
299display until the next time it finds unread news. (The mapwindow
300command causes tknewsbiff to restore the window.)
301
302As an example, here is a binding to pop up an xterm and run rn when
303you hold down the shift key and press button 1 in the listing window.
304
305.nf
306
307bind .list <Shift-1> {
308 exec xterm -e rn &
309}
310
311.fi
312
313Here is a similar binding. However it tells rn to look only at the
314newsgroup that is under the mouse when you pressed it. (The
315"display_list" variable is described later in this man page.)
316
317.nf
318
319bind .list <Shift-1> {
320 exec xterm -e rn [lindex $display_list [.list nearest %y]] &
321}
322
323.fi
324
325.SH OTHER COMMANDS AND VARIABLES
326
327Built-in commands already mentioned are: watch, ignore, display, help,
328update-now, unmapwindow, and mapwindow.
329
330Any Tcl and Tk command can also be given. In particular, the list of
331newsgroups is stored in the list widget ".list", and the scroll bar is
332stored in the scrollbar widget ".scroll". So for example, if you want
333to change the foreground and background colors of the newsgroup list,
334you can say:
335
336.nf
337
338 .list config -bg honeydew1 -fg orchid2
339
340.fi
341
342These can also be controlled by the X resource database as well.
343However, the configuration file allows arbitrarily complex commands to
344be evaluated rather than simple assignments.
345
346Certain Tcl/Tk commands can disrupt proper function of tknewsbiff.
347These will probably be obvious to anyone who knows enough to give
348these commands in the first place. As a simple example, the program
349assumes the font in the list box is of fixed width. The newsgroups
350will likely not align if you use a variable-width font.
351
352The following variables are accessible and can be used for esoteric
353uses. All other variables are private. Private variables and
354commands begin with "_" so you don't need to worry about accidental
355collisions.
356
357The array "db" is a database which maintains information about read
358and unread news. db($newsgroup,hi) is the highest article that
359exists. db($newsgroup,seen) is the highest article that you have
360read.
361
362A number of lists maintain interesting information. "active_list" is a
363list of known newsgroups. "seen_list" is a list of newsgroups that
364have been seen so far as the -new and -display flags are being
365processed. "previous_seen_list" is "seen_list" from the previous
366cycle. "ignore_list" is the list of newsgroup patterns to ignore.
367"watch_list" is the list of newsgroup patterns to watch.
368"display_list" is the list of newsgroup will be displayed at the next
369opportunity.
370
371.SH UPDATING YOUR FILES
372
373tknewsbiff automatically rereads your configuration file each time it
374wakes up to check for unread news. To force tknewsbiff to reread the
375file immediately (such as if you are testing a new configuration or
376have just modified your newsrc file), press button 2 in the display
377(see BUTTONS above).
378
379.SH CAVEATS
380
381tknewsbiff defines the number of unread articles as the highest
382existing article minus the highest article that you've read. So if
383you've read the last article in the newsgroup but no others,
384tknewsbiff thinks there are no unread articles. (It's impossible to
385do any better by reading the active file and it would be very time
386consuming to do this more accurately via NNTP since servers provide no
387efficient way of reporting their own holes in the newsgroups.)
388Fortunately, this definition is considered a feature by most people.
389It allows you to read articles and then mark them "unread" but not
390have tknewsbiff continue telling you that they are unread.
391
392.SH UNWARRANTED CONCERNS
393
394Your news administrator may wonder if many people using tknewsbiff
395severely impact an NNTP server. In fact, the impact is negligible
396even when the delay is very low. To gather all the information it
397needs, tknewsbiff uses a single NNTP query - it just asks for the
398active file. The NNTP server does no computation, formatting, etc, it
399just sends the file. All the interesting processing happens locally
400in the tknewsbiff program itself.
401
402.SH BUGS
403
404The man page is longer than the program.
405
406.SH SEE ALSO
407.I
408"Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Programs"
409\fRby Don Libes,
410O'Reilly and Associates, January 1995.
411.SH AUTHOR
412Don Libes, National Institute of Standards and Technology