; $VER: FSEScriptOut V1.3 (16.12.93) PGP support by Christian Sandberg
.key Filename/a,width/a
.bra {
.ket }

failat 99

set Msgfile `list "{Filename}" lformat="%s"`

if exists ENV:FSEPGP.$Msgfile
     search "{filename}" "-=-=-=-=-=-DO NOT PGPCRYPT!-=-=-=-=-=-"
     if WARN
          skip crypt
          endif
     grep >"t:$Msgfile" -v "PGPCRYPT!" "{filename}"
     copy "t:$Msgfile" "{filename}"
     unsetenv FSEPGP.$Msgfile
     delete "t:$Msgfile"
     skip quit
     endif

search "{filename}" "-=-=-=-=-=-    PGPCRYPT!   -=-=-=-=-=-"
if not WARN
     skip crypt
     endif

skip quit

lab crypt

if not exists ENV:FSEPGP.$Msgfile   ; Denne vil *ikke* virke med $FSEPGP.$Msgfile !! :-(
      grep >"t:$Msgfile" -v "PGPCRYPT!" "{filename}"
      copy "t:$Msgfile" "{filename}"
      endif
if not exists ENV:PGPPASS
     setenv PGPPASS "`ESR "" "Enter PGP password:"`"
     endif
path $PGPPATH add
pgp >>"t:out.$Msgfile" -o "t:$Msgfile" -eas "{filename}" "`ESR "" "Who is the PGP message for?"`"
if WARN
     type >"CON:0/10//200/PGP Error Msg/CLOSE/WAIT/ScreenTHOR" "t:out.$Msgfile"
     copy "{filename}" "t:$Msgfile.asc"
     endif
copy "t:$Msgfile.asc" "{filename}"
delete "t:$Msgfile" "t:$Msgfile.asc" "t:out.$Msgfile"
unsetenv FSEPGP.$Msgfile
unset Msgfile

lab quit
