2 # NEWT, their six-year-old daughter, yells from the back...
13 newtname=newt@dont-email.me
17 echo Newsgroups: `{echo $group | sed 's/\//\./g'}
18 echo Subject: $"subject
21 eval $editor /tmp/post
24 cat /tmp/post >$mnt/$group/post
26 fn f { du -a $* | sed 's/^.* //g' }
29 if(! ~ $date(1) [0-9]*)
48 if(! ~ $date(3) `{date | awk '{print $6;}'})
51 ti=`{echo $date(4) | awk '{print substr($0,0,5);}'}
52 if(! ~ $#mo 0 && ! ~ $#da 0 && ! ~ $#ti 0)
59 from=`{awk -F ' ' '{print $3;}' $rposts($i)^/xover >[2]/dev/null}
60 if(! ~ $#from 0 && ! ~ $#from 1){
64 echo $i | sed 's/(<|>)//g'
72 date=`{awk -F ' ' '{print $4;}' $rposts($i)^/xover >[2]/dev/null | fmtd}
75 subject=`{awk -F ' ' '{print substr($2,0,50);}' $rposts($i)^/xover >[2]/dev/null}
78 # unicode 00a0 divides message number from headline.
79 # command input ignores everything after unicode 00a0.
80 # these lines may be selected and sent to the prompt.
81 echo ' '$"i' '$"date' '$"from' '$"subject
84 fn getposts{ ls | grep -e '^[0-9]+$' | sort -n | tail -$maxposts }
88 case ,*; seq 1 `{echo $* | sed 's/,//g'}
89 case *,; seq `{echo $* | sed 's/,//g'} $posts($#posts)
90 case *,*; seq `{echo $* | sed 's/,/ /g'}
94 fn h{ sed -n $1^p /tmp/h }
96 kmnt=`{echo $mnt | sed 's/\//\\\//g'}
98 grep -v -e '\/([0-9]+|article|body|header|post|xover)$' |
99 sed 's/^'$"kmnt'\// g /g' |
102 fn nshift{ shift; echo $* }
104 echo 'Commands are of the form [<range>] <command> [args]
105 <range> := <addr> | <addr>','<addr>
107 b print the next ten headers
109 g ... go to specified group
110 h print message headline (,h for all)
111 help print this help message
112 k ... list sub-groups under specified group
113 kf ... grep $home/lib/newsgroups for regexp
114 p print message with minimal headers
115 P print message with full headers
118 y synchronize message list with server
119 " print message in quoted form, suitable for reply
120 |cmd pipe message body to a command
121 ||cmd pipe raw message to a command
122 ? print debug information'
125 if(test $1 -le $#rposts && test -f $mnt/$group/$rposts($1)^/body){
127 grep -e '(^From|^Newsgroups|^Subject|^Date)' $rposts($1)^/header
129 cat $rposts($1)^/body
140 if(test $1 -le $#rposts && test -f $mnt/$group/$rposts($1)^/article)
141 cat $rposts($1)^/article
149 if(test $1 -le $#rposts && test -f $mnt/$group/$rposts($1)^/header){
150 subject=`{grep -e '^Subject: ' $mnt/$group/$rposts($1)^/header | sed 's/^Subject: //g'}
151 if(! ~ $subject RE:* Re:* re:*)
152 subject=(Re: $subject)
156 echo !message missing
163 posts=`{seq 1 $#rposts}
167 echo $#posts messages
172 echo -n $* ' (y, n) '
181 fn '"' {{p $1 | sed 1d | sed 's/^/> /g' | sed 's/^> >/>>/g' | sed '$d'; echo}}
183 echo usage: $argv0 '[ -f newsgroup ] [ -m mountpoint ] [ -p maxposts ]' >[1=2]
189 group=`{echo $2 | sed 's/\./\//g'}
205 if(! test -d $mnt/$group){
206 echo !$mnt/$group does not exist >[1=2]
209 builtin cd $mnt/$group
213 # command input ignores everything after unicode 00a0.
214 rcmd=`{read | sed 's/[ ].*$//g' | sed 's/^([0-9]+)?(,)?([0-9]+)?/& /g'}
227 r=`{seq $r(1) `{echo $r(1)^+10|bc}}
228 if(test $r($#r) -gt $posts($#posts))
229 r=`{seq $r(1) $posts($#posts)}
230 if(! ~ $#r 0 && test $r(1) -le $posts($#posts)){
231 sed -n $r(1)^,$r($#r)^p /tmp/h
240 ngroup=`{nshift $cmd | sed 's/\./\//g'}
241 if(test -d $mnt/$ngroup){
242 if(grep -s -e '^[0-9]+$' <{ls -p $mnt/$ngroup}){
244 builtin cd $mnt/$group
248 echo !$ngroup contains no messages
251 echo !$ngroup does not exist
262 k `{nshift $cmd | sed 's/\./\//g'}
264 grep -e `{nshift $cmd} $home/lib/newsgroups |
288 cmd=`{echo $"cmd | sed 's/^\|\|//g'}
289 cat $mnt/$group/^$rposts($post)^/article | eval $cmd
291 cmd=`{echo $"cmd | sed 's/^\|//g'}
292 cat $mnt/$group/^$rposts($post)^/body | eval $cmd
296 echo maxposts: $maxposts
299 echo 'rposts(r):' $rposts($r)
304 if(~ $post $posts(1) && ~ $#go 0)
306 if not if(! ~ $post $posts($#posts)){
307 post=`{echo $post^+1 | bc}
308 if(test $post -gt $posts($#posts))