Re: TRN: Is the separate Pnews used for "F(ollowup)"? (want to hack it)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 05, 2002 at 04:17:03PM -0400, David Combs wrote:
> Now, since Pnews is just a shell-script, this hack would be easy
> enough to do -- *if* that same Pnews script was the mechanism trn used
> for followups.

Yes, it is.

> Also, what to define or how to modify $path to make trn use *my*
> hacked-version of Pnews (ie, how does trn-code *ref* Pnews?  By some
> relative-ref based on where trn that's now running "lives"?

It uses the NEWSPOSTER environment variable (see the Configuration /
Environment Variables help file). The default is 'Pnews -h %h', so it
uses $PATH, but this may have been altered by whoever configured your
trn build: for example, the Debian package uses '/usr/lib/trn4/Pnews -h
%h' because it takes care to allow trn3 and trn4 to coexist.

I have been known to set $NEWSPOSTER to a Pnews-wrapper script which
does some extra things for me and then calls Pnews. For instance, this
is hardly polished but works well enough for me:

  #! /bin/sh
  
  if [ "X$1" = X-h ] && grep '^References: ' $2 > /dev/null; then
    echo ""
    echo -n "Remove original poster's .signature (if present)? [yn] "
    read ans
    case $ans in
      n*) ;;
      *)  sed -n -e "/^\($QUOTECHARS\)\?-- \$/q" -e p $2 | sponge $2
          ;;
    esac
  fi
  
  exec Pnews "$@"

(Erm, 'sponge' is a little utility I wrote that soaks up all its input
and then writes it to the output file you give it, only opening the
output file after it's read all the input so that you don't have to
worry about redirections clobbering the input file at the wrong time. If
I were writing it now I'd probably say something like 'perl -pi -e "exit
if /^(?:\Q$ARGV[0]\E)?-- \$/" "$QUOTECHARS" $2' instead.)

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm


[Index of Archives]     [Photo]     [Yosemite]     [Epson Inkjet]     [Mhonarc]     [Nntpcache]

  Powered by Linux