Metropoli BBS
VIEWER: postnews.demon MODE: TEXT (ASCII)
/*
** Postnews Replacement Script
** GRn Can Now Post News :-)
*/
Parse arg result
a = 1
art = word(result,1)
art2 = word(result,3)
alreadyinsertedfile = "FALSE"
org = "The Martin Hunt Fan Club"
if open(org,"env:organization","R") then
do
   organisation = readln(org)
   call close(org)
end
if open(org,"env:organisation","R") then
do
   organisation = readln(org)
   call close(org)
end
if art2 = "" then
do
  call open(file,art,"A")
  call seek(file,0,"B")
  a = 1
  newsgroup = readln(file)
  line.1 = newsgroup
  a = 2
  line.2 = "Organization: "||organisation
  do until eof(file)
    a = a + 1
    line.a = readln(file)
    if compress(line.a) == "--" then
    do
      call signature()
      lev = 1
    end
    if lev = 1 then leave
  end
  call close(file)
  call open(file,art,"W")
  call seek(file,0,"B")
  do i = 1 to a
     call writeln(file,line.i)
  end
  call close(file)
end

if art2 ~="" then
do
  call open(file,art,"A")
  call seek(file,0,"B")
  newsgroup = readln(file)
  a = 2
  sig = 0
  do while ~eof(file) & ~Sig
    a = a + 1
    if alreadyinsertedfile == "FALSE" then call insertfile2()
    line.a = readln(file)
    if compress(line.a) == "--" then call signature()
    if upper(word(line.a,1)) == "FROM:" then a = a - 1
  end
  call close(file)
  n = 1
  quitflag = 0
  do until quitflag
     filename = "t:grn-file."||n
     if ~exists(filename) then quitflag = 1
     n = n + 1
  end
  art = filename
  call open(file,art,"W")
  call seek(file,0,"B")
  line.1 = "To:"
  line.2 = newsgroup
  line.3 = "Organization: "||organisation
  do i = 1 to a
     call writeln(file,line.i)
  end
  call close(file)
end

if a == 0 then address command "amitcp:bin/sendmail <" art "-f $USER -t mail2news@news.demon.co.uk"
if a ~== 0 then address command "amitcp:bin/sendmail <" art "-f $user -t mail2news@news.demon.co.uk "
exit

insertfile2:
  call open(file2,art2,"R")
  do while ~eof(file2)
    a = a + 1
    line.a = readln(file2)
    if word(line.a,1) == "X-NewsSoftware:" then line.a = "X-NewsSoftware: GRn 2.1 19/2/94 (PostNews Fix 31/3/95 Martin Hunt)"
  end
  alreadyinsertedfile = "TRUE"
  call close(file2)
RETURN

Signature:
parse var newsgroup title ": " name.1 "." name.2 "." name.3 "." name.4 "." name.5 "." name.6 "." name.7 "." name.8 "." name.9 "." name.10
nameno = 1
sigfile = "uunews:"
do while name.nameno ~== ""
  sigfile = sigfile || name.nameno ||"/"
  nameno = nameno + 1
end
sigfile = sigfile ||".sig"
if open(sig,sigfile,"R") then
do
  do until eof(sig)
    a = a + 1
    line.a = readln(sig)
  end
  call close(sig)
  sig = 1
end
return
[ RETURN TO DIRECTORY ]