diff --git a/news-cancel b/news-cancel index 129378f5..fe5dccd6 100755 --- a/news-cancel +++ b/news-cancel @@ -6,7 +6,7 @@ ## Login stransky ## ## Started on dim 13 jan 2002 02:30:56 CET Nicolas STRANSKY -## Last update sam 27 avr 2002 00:56:25 CEST Nicolas STRANSKY +## Last update ven 19 sep 2003 14:21:27 CEST Nicolas STRANSKY ## ## Script pour annuler ou modérer un message de news. ## @@ -20,31 +20,38 @@ if [[ "${ORIG_LOGNAME-$SUDO_USER}" = "" ]] else moderateur=${ORIG_LOGNAME-$SUDO_USER} fi +ovfiles=$(grep "^[[:digit:]]" /etc/news/buffindexed.conf | cut -d ':' -f 2 | tr "\n" " ") groupe=adm tempF=$(tempfile -d /tmp -p "newscancel") tempF2=$(tempfile -d /tmp -p "newscancelcommentaire") tempF3=$(tempfile -d /tmp -p "newscancelmessage") VERIF () { - ligne=`grep --binary-files=text " $1 " /var/spool/news/overview/OV1 | head -n 1 | awk -F "\t" '{print $1"~"$2"~"$3"~"$9}'` + ligne=`grep -h --binary-files=text " $1 " $ovfiles | head -n 1 | awk -F "\t" '{print $1"~"$2"~"$3"~"$9}'` auteur=`echo $ligne | awk -F "~" '{print $3}'` titre=`echo $ligne | awk -F "~" '{print $2}'` newsgroup=`echo $ligne | awk -F "~" '{print $4}' | awk '{print $3}' | awk -F : '{print $1}'` #numero=`echo $ligne | awk -F "~" '{print $1}'` numero=`echo $ligne | awk -F "~" '{print $4}' |awk -v VAR1=$newsgroup 'BEGIN {RS = " "} ; $0 ~ VAR1 {print $1}' | awk -F ":" '{print strtonum($2)}'` - echo "il s'agit du message $titre, numéro $numero, posté par $auteur dans $newsgroup" - echo "" - echo -n "exact ? [o/n] " - read confirmation - case $confirmation in - o*|O*) - ;; - - *) - echo "On ne fait rien." - exit 0 - ;; - esac + + if [[ $ligne != "" ]] ; then + echo "il s'agit du message \"$titre\", numéro $numero, posté par $auteur dans $newsgroup" + echo "" + echo -n "exact ? [o/n] " + read confirmation + case $confirmation in + o*|O*) + ;; + + *) + echo "On ne fait rien." + exit 0 + ;; + esac + else + echo "Aucun message ne correspond à cette ID" + exit 1 + fi }