home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / gensys0.11.lha / gensys.notifyuser < prev    next >
Text File  |  1993-12-19  |  3KB  |  90 lines

  1. /* gensys.notifyuser, (c) Sun, 19 Dec 1993 04:35:37 +0100 by "Kai 'wusel' Siering" <wusel@3jean[.uucp|.hanse.de]> */
  2. /*
  3.  * $Header:$
  4.  * $Log:$
  5.  *
  6.  */
  7.  
  8. HostName    = ''
  9. DomainName  = ''
  10. NewsMaster  = ''
  11. UserName    = ''
  12. Organization= ''
  13. TmpFileName = 't:gensys.'pragma('ID')'.tmp'
  14. TargetSite  = 'manual-host'
  15.  
  16. if(open(conf, "uulib:config", r)) then do
  17.    do while ~eof(conf)
  18.       in=readln(conf)
  19.  
  20.       in2 = Translate(in, ' ', D2C(9))
  21.       parse var in2 key cont
  22.  
  23.       select
  24.          when upper(key)="NODENAME"     then HostName   = strip(cont)
  25.          when upper(key)="DOMAINNAME"   then DomainName = strip(cont)
  26.          when upper(key)="NEWSMASTER"   then NewsMaster = strip(cont)
  27.          when upper(key)="USERNAME"     then UserName   = strip(cont)
  28.          when upper(key)="ORGANIZATION" then Organization = strip(cont)
  29.          otherwise nop
  30.       end
  31.    end
  32.    err=close(conf)
  33. end
  34. else do
  35.    say 'Configuration file (UUlib:config) not found, aborting.'
  36.    exit(20)
  37. end
  38.  
  39. if NewsMaster = '' then NewsMaster = UserName
  40. if NewsMaster = '' then NewsMaster = 'postmaster'
  41.  
  42. ThisSite = HostName||DomainName
  43.  
  44. if(open(out, TmpFileName, 'write')) then do
  45.    call writeln(out, 'From: 'NewsMaster'@'ThisSite)
  46.    call writeln(out, 'Subject: setsys')
  47.    call writeln(out, 'To: postmaster@'TargetSite)
  48.    call writeln(out, 'Reply-To: 'UserName'@'ThisSite)
  49.    call writeln(out, 'Organization: 'Organization)
  50.    call writeln(out, '')
  51.    call writeln(out, 'Moin,')
  52.    call writeln(out, '')
  53.    call writeln(out, 'mein wahnsinnig genialer Daemon hat festgestellt, dasz ich')
  54.    call writeln(out, 'von Dir folgende Gruppen braeuchte,  die Du mir bitte ein-')
  55.    call writeln(out, 'tragen moechtest  (sofern Du einen Automatismus zur Aende-')
  56.    call writeln(out, 'rung meines sys-Eintrags hast, teile mir bitte die notwen-')
  57.    call writeln(out, 'digen Daten mit, damit dies in Zukunft automatisch geht).')
  58.    call writeln(out, '')
  59.    call writech(out, HostName'/'ThisSite':')
  60.  
  61.    LeftPos=40
  62.    SetComma=0
  63.  
  64.    do forever
  65.       Line = readln(stdin)
  66.       if eof(stdin) then break
  67.  
  68.       if(SetComma=1) then call writech(out, ',')
  69.  
  70.       if(LeftPos+Length(Line)>78) then do
  71.          call writeln(out, '\')
  72.          LeftPos=1
  73.       end
  74.  
  75.       SetComma=1
  76.  
  77.       call writech(out, compress(Line))
  78.       LeftPos=LeftPos+Length(Line)
  79.    end
  80.    call writeln(out, '/all:F:')
  81.    call close(out)
  82.    address COMMAND 'sendmail <'TmpFileName
  83.    address COMMAND 'delete 'TmpFileName' >nil:'
  84. end
  85. else
  86. do
  87.    say 'Can''t open 'TmpFileName' for writing ...')
  88.    exit(20)
  89. end
  90.