Debian Codegraph @

contrib/nnsum

raw symbols SCIP
1 #! /bin/sh
2 # Copyright (C) 1992,1993 Bernd Felsche,
3 # Metapro Systems & DIALix Services ; Perth, Western Australia
4 # All rights reserved
5 #
6 # This software is freely distributable as part of the "nn"
7 # newsreader package as long as this Copyright notice remains
8 # intact.
9 #
10 # Run by news periodically, to update the newsrc file
11 # and to report the number of articles received since
12 # the last datum point.
13 #
14 # e.g. crontab:
15 # 29,59 * * * * /usr/local/lib/nn/nnsum report
16 # 01 00 * * * /usr/local/lib/nn/nnsum zero
17 #
18 # /etc/profile can then do something like:
19 # /usr/lib/news/nnsum
20 # to display the number of new news articles when users login.
21 #
22 # The report to users looks something like this:
23 # metapro has received 24332 articles in 928 groups today.
24 #
25 # UTSL.
26
27 # Configure the following to fit your news and nn installation.
28 PATH=/bin:/usr/bin:/usr/local/bin
29 HOME=/usr/lib/news
30 MAIL=/usr/mail/news
31 NEWSRC=$HOME/.newsrc
32 ACTIVE=$HOME/active
33 TERM=dumb
34 export PATH TERM MAIL HOME
35
36 REPORT=/usr/lib/news/NEWARTS
37
38 cd $HOME
39
40 case "$1" in
41 report)
42 SYSTEM=`uuname -l`
43 NEWAGE=`find $NEWSRC -mtime -1 -print 2>/dev/null`
44 [ "$NEWAGE" = "$NEWSRC" ] && DAY=today || DAY=recently
45 echo \
46 `nncheck -f "$SYSTEM has received %U net news articles in %g $DAY"` \
47 > $REPORT
48 ;;
49 zero)
50 sed 's+^\([^ ]*\) 0*\([0-9][0-9]*\) .*$+\1: 1-\2+' $ACTIVE > $NEWSRC
51 ;;
52 *)
53 [ -f $REPORT -a -r $REPORT ] && cat $REPORT
54 ;;
55 esac
56
57 exit 0