#!/usr/local/bin/perl # [postpgp.pl] v. 2.1 # # written by jason steiner, jsteiner@anwsun.phya.utoledo.edu, Jan 1993 # # if you use or make improvements to this program i would appreciate # copies of your modifications & your PGP public key. # # [06.03.1998] modified by René Scholz <mrz@informatik.uni-jena.de> # for better+easier code (more perl, less awk :) # # [21.07.1998] modified by René Scholz <Voland@Jena.Thur.de> # for using switches in editor_command: # set editor_command "$HOME/Bin/postpgp.pl %s -g %d" ####################################################################### $HANDLE_POINTS=0; # if 1: change . to _. (for inews) ($visual=$ENV{'EDITOR'}) || ($visual="/usr/local/bin/jed"); $name=$ARGV[0]; # name of edited file in /tmp (or so) system($visual,@ARGV); # create posting with editor print "Sign this message? [yN]: "; chomp($_=<STDIN>); if(lc($_) eq "y") { push(@opts, '-st', '+clearsig=on'); &sign_message(); } sub sign_message { if(@opts) { open(INPUT,$name); open(HEAD,">$name.head"); open(BODY,">$name.body"); while (<INPUT>) { if (1 .. /^$/) { print HEAD; } else { s/^\./_./ if($HANDLE_POINTS); print BODY; } } close(HEAD); close(BODY); system('pgp', '-a', @opts, "$name.body"); system "cat $name.head $name.body.asc > $name"; unlink("$name.head", "$name.body", "$name.body.asc"); } }