From decwrl!ucbvax!ucsd!usc!cs.utexas.edu!uunet!allbery Mon May  7 07:38:07 PDT 1990
Article 1507 of comp.sources.misc:
Path: decwrl!ucbvax!ucsd!usc!cs.utexas.edu!uunet!allbery
From: levy@cbnewsc.ATT.COM (Daniel R. Levy)
Newsgroups: comp.sources.misc
Subject: v12i027: fol -- show followups to current article
Message-ID: <87529@uunet.UU.NET>
Date: 5 May 90 17:10:30 GMT
Sender: allbery@uunet.UU.NET
Organization: AT&T Bell Laboratories, Naperville IL
Lines: 101
Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)

Posting-number: Volume 12, Issue 27
Submitted-by: levy@cbnewsc.ATT.COM (Daniel R. Levy)
Archive-name: fol/part01

#! /bin/sh
# This file was wrapped with "dummyshar".  "sh" this file to extract.
# Contents:  fol
echo extracting 'fol'
if test -f 'fol' -a -z "$1"; then echo Not overwriting 'fol'; else
sed 's/^X//' << \EOF > 'fol'
X#!/bin/sh
X#
X# fol -- list the followups to the current article ($A).
X#
X# Invoke from "readnews" or "vnews" as "!fol" or "!fol -v".
X# This may be compatible with other UNIX news readers as is, or with some
X# minor modifications.
X#
X# If invoked as "fol -v" (or with any other argument) you are placed
X# in "view" on the followups, if there are any.
X#
X# This is for netnews users who have ants in their pants wanting to followup
X# to a post, but want to be sure nobody else has said the same thing first :-).
X# It is written in boring but ubiquitous Bourne Shell for maximum portability.
X#
X# Written 5/2/90 by Dan Levy, ttbcad!levy, AT&T Bell Labs
X#
X
XPATH=/usr/5bin:/bin:/usr/bin:/usr/ucb/bin:$PATH; export PATH
X
Xecho	#in case not already at the left margin
X
Xif test -z "$A"
Xthen
X	echo \$A is null or not set >&2
X	exit 1
Xelif test ! -f "$A" -o ! -r "$A"
Xthen
X	echo File \$A="'$A'" not found or unreadable >&2
X	exit 1
Xfi
X
Xcase $A in
X	/*)	;;
X	*)	echo File \$A="'$A'" not a full path name >&2
X		exit 1
X		;;
Xesac
X
XF=`basename $A`
X
Xif expr $F : '[1-9][0-9]*$' >/dev/null
Xthen
X	:
Xelse
X	echo FILE \$A="'$A'" does not have numeric basename >&2
X	exit 1
Xfi
X
XD=`dirname $A`
X
Xcd $D || exit 1
X
XM=`grep '^Message-ID:' $A | line | (read M I R; echo $I)`
X
Xif test -z "$M"
Xthen
X	echo FILE \$A="'$A'" has no Message-ID in it >&2
X	exit 1
Xfi
X
Xecho Looking for followups to $F in this news group
X
XL=`ls | awk '($1 + 0 > '$F')' | sort -n`
XFU=`grep "^References:" $L /dev/null |
X	awk -F: '(index($0,"'$M'") > 1) { print $1 }`
X
Xif test -n "$FU"
Xthen
X	echo Followups to $F in this news group: $FU
X	if test $# -ne 0
X	then
X		echo Type return to enter \"view\" on followups:
X		read x
X		view $FU
X	fi
Xelse
X	echo No followups to $F found in this news group
Xfi
X
Xexit 0
EOF
chars=`wc -c < 'fol'`
if test $chars !=     1734; then echo 'fol' is $chars characters, should be     1734 characters!; fi
fi
exit 0
-- 
Daniel R. Levy                        >>> God: just say "yes" <<<
AT&T Bell Laboratories        UNIX(R) mail:  att!ttbcad!levy, att!cbnewsc!levy
1000 East Warrenville Rd.     Any opinions expressed in the message above are
Naperville, Illinois  60566   mine, and not necessarily AT&T's.


