$!-----------------------------------------------------------------
$!
$!	UNREAD- Utility Build- Procedure  V1.0       20-NOV-1989
$!
$!-----------------------------------------------------------------
$!
$!	Author: 
$!
$!		Gerhard Lust
$!		Geotechnisches Institut
$!		Bundesversuchs- und Forschungsanstalt Arsenal
$!		Faradaygasse 3
$!		A-1030 Wien
$!
$!		Tel.: +043/222/782531/518
$!		Datexp : PSI%023226191064::SYSTEM
$!
$!--------------------------------------------------
$!
$! There ist no copyright attached to this program.
$! Use it at your own risk.
$!
$!--------------------------------------------------
$!
$ write sys$output "Creating Subdirectory [.UNREAD]"
$ create/dir [.unread]
$ set def [.unread]
$ write sys$output "Creating all files..."
$ write sys$output " "
$ write sys$output "Creating CHECK_ACCESS.FOR"
$ CREATE CHECK_ACCESS.FOR
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
	subroutine	check_access
c
	implicit	integer*4 (a-z)
c
	integer*4	flag/'00000001'x/	! check Read- Access
c
	include		'($prvdef)'
	include		'($acldef)'
	include		'($chpdef)'
	include		'($ssdef)'
	include		'common.txt'
c
	structure/acc_list/
		integer*2	buflen/4/
		integer*2	code/chp$_flags/
		integer*4	bufadr
		integer*4	retlenadr
		integer*4	end/0/
	end structure
	record/acc_list/access
c
	access.bufadr = %loc(flag)
c
	stat = sys$check_access (%ref(acl$c_file),
	1 old_mail_dir(:old_mail_dir_len)//'MAIL.MAI',
	1 owner(:owner_len),%ref(access.buflen))
c
	if (stat.ne.ss$_normal) then
		if (alluser_stat.eq.1) then
			call getpriv
			if (.not.lib$bbcci(prv$v_sysprv,priv)) then
				call message (4,username,username_len)
				alluser_stat = 0
			end if
		end if
c
	end if
c
1000	return
c
	end
$ EOD
$ write sys$output "Creating GETDEFAULT.FOR"
$ CREATE GETDEFAULT.FOR
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
	subroutine	getdefault
c
	include		'common.txt'
c
	foldername	   = 'NEWMAIL'
	forwardname	   = ' '
	subdir		   = ' '
	directory	   = ' '
	device		   = ' '
	default_dir	   = ' '
	old_mail_dir	   = ' '
	subdir		   = ' '
	vmsmailfile	   = 'sys$system:vmsmail_profile.data'
c
	device_len	      = 0
	directory_len	      = 0
	default_dir_len	      = 0
	old_mail_dir_len      = 0
	foldername_len        = 0
	subdirblock	      = 0
	subdirblock_len       = 0
	forwardnameblock      = 0
	forwardnameblock_len  = 0
	record_pointer	      = 0
	alluser_stat	      = 0
c
	call str$trim	(forwardname,forwardname,forwardname_len)
	call str$trim	(subdir,subdir,subdir_len)
	call str$trim	(vmsmailfile,vmsmailfile,vmsmailfile_len)
	call str$trim	(foldername,foldername,foldername_len)
c
	return
c
	end
$ EOD
$ write sys$output "Creating GETDEFDIR.FOR"
$ CREATE GETDEFDIR.FOR
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
	subroutine	getdefdir
c
	implicit	integer*4 (a-z)
c
	include		'($uaidef)'
	include		'($ssdef)'
	include		'common.txt'
c
c------------------------------------------------------------------------
c
	structure/uai_list/
		integer*2	uai_len_device/32/
		integer*2	uai_code_device/uai$_defdev/
		integer*4	uai_bufadr_device
		integer*4	uai_retlen_device
		integer*2	uai_len_directory/64/
		integer*2	uai_code_directory/uai$_defdir/
		integer*4	uai_bufadr_directory
		integer*4	uai_retlen_directory
		integer*4	end_list/0/
	end structure
	record/uai_list/uai
c
	uai.uai_bufadr_device		= %loc (device)
	uai.uai_bufadr_directory	= %loc (directory)
c
c-------------------------------------------------------------------------
c
	uaf_dir_stat = sys$getuai(,,username,%ref(uai),,,)
	if (uaf_dir_stat.ne.ss$_normal) goto 1000
c
	call str$trim (directory,directory,directory_len)
	call str$trim (device,device,device_len)
c
	default_dir = device(2:device_len)//'['//
	1 directory(3:directory_len-1)//']'
c
	call str$trim (default_dir,default_dir,default_dir_len)
c
1000	return
c
	end

$ EOD
$ write sys$output "Creating GETOWNER.FOR"
$ CREATE GETOWNER.FOR
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
	subroutine	getowner
c
	implicit	integer*4 (a-z)
c
	include		'($jpidef)'
	include		'common.txt'
c
	structure/jpi_list/
		integer*2	jpi_len_user/12/
		integer*2	jpi_code_user/jpi$_username/
		integer*4	jpi_bufadr_user
		integer*4	jpi_retlen_user
		integer*4	end_list/0/
	end structure
	record/jpi_list/jpi
c
	jpi.jpi_bufadr_user = %loc (owner)
c
	owner = ' '
c
	stat = sys$getjpiw (,,,%ref(jpi.jpi_len_user),,,)
c
	call str$trim (owner,owner,owner_len)
c
	return
c
	end
$ EOD
$ write sys$output "Creating GETPRIV.FOR"
$ CREATE GETPRIV.FOR
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
	subroutine	getpriv
c
	implicit	integer*4 (a-z)
c
	include		'($jpidef)'
	include		'common.txt'
c
	structure/jpi_list/
		integer*2	jpi_len_priv/8/
		integer*2	jpi_code_priv/jpi$_procpriv/
		integer*4	jpi_bufadr_priv
		integer*4	jpi_retlen_priv
		integer*4	end_list/0/
	end structure
	record/jpi_list/jpi
c
	jpi.jpi_bufadr_priv = %loc (priv)
c
	stat = sys$getjpiw (,,,%ref(jpi.jpi_len_priv),,,)
c
	return
c
	end
$ EOD
$ write sys$output "Creating MESSAGE.FOR"
$ CREATE MESSAGE.FOR
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
	subroutine	message (msg_flg,text,text_len)
c
	implicit	integer*4 (a-z)
c
	character*80	text
	integer*2	text_len,msg_flg
c
	include		'common.txt'
c
c*-------------------------------------------------------------------------
c
	if (english.eq.1) then
		if (msg_flg.eq.1) then
			write (*,'('' %UNREAD-I-NOMAIL, '',
	1		''user '',a,'' has no selected mail.'')')
	1		text(:text_len)
c
		else if (msg_flg.eq.3) then
			write (*,'('' %UNREAD-F-NOFIL, '',
	1		''file /'',a,''/ not found.'')') text(:text_len)
c
		else if (msg_flg.eq.4) then
			write (*,'('' %UNREAD-W-NOPRIV, '',
	1		''qualifier for '',a,'' ignored '',
	1		''-> SYSPRV required.'')') text(:text_len)
c
		else if (msg_flg.eq.5) then
			write (*,'('' %UNREAD-I-FORWD, '',
	1		''mails forwarded to user '',a,'' .....'')')
	1		text(:text_len)
c
		else if (msg_flg.eq.6) then
			write (*,'('' %UNREAD-E-NOUSR, '',
	1		''no user /'',a,''/ in profile.'')')
	1		text(:text_len)
c
		end if
c
	else
c
		if (msg_flg.eq.1) then
			write (*,'('' %UNREAD-I-NOMAIL, '',
	1		''Benutzer '',a,
	1		'' hat keine gesuchte Mail.'')')
	1		text(:text_len)
c
		else if (msg_flg.eq.3) then
			write (*,'('' %UNREAD-F-NOFIL, '',
	1		''Datei /'',a,''/ nicht gefunden.'')')
	1		text(:text_len)
c
		else if (msg_flg.eq.4) then
			write (*,'('' %UNREAD-W-NOPRIV, '',
	1		''Qualifier bei '',a,'' ignoriert -> '',
	1		''SYSPRV notwendig.'')') text(:text_len)
c
		else if (msg_flg.eq.5) then
			write (*,'('' %UNREAD-I-FORWD, '',
	1		''Mails weitergeleitet zum Benutzer '',a,'' .....'')')
	1		text(:text_len)
c
		else if (msg_flg.eq.6) then
			write (*,'('' %UNREAD-E-NOUSR, '',
	1		''Kein Benutzer /'',a,''/ im VMSMAIL-Profile.'')')
	1		text(:text_len)
c
		end if
c
	end if
c
	return
c
	end
$ EOD
$ write sys$output "Creating READ_FORWARDNAME_BLOCK.FOR"
$ CREATE READ_FORWARDNAME_BLOCK.FOR
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
	subroutine	read_forwardname_block
c
	implicit	integer*4 (a-z)
c
	include		'common.txt'
c
	forwardnameblock	 = block
	forwardnameblock_len 	= block_len
c
	if (forwardnameblock_len.gt.0) then
		forwardname = vmsmail_record
	1	(record_pointer + 1 : record_pointer + 1
	1	+ forwardnameblock_len)
		forwardname_len = forwardnameblock_len
	end if
c
	return
c
	end	
$ EOD
$ write sys$output "Creating READ_MAILFILE.FOR"
$ CREATE READ_MAILFILE.FOR
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
	subroutine	read_mailfile
c
	implicit	integer*4 (a-z)
c
	integer*2	zeile
c
	include		'common.txt'
c
c*---------------------------------------------------------------------
c
	zeile = 0
c
	if ((alluser_stat.eq.1).and.
	1 (owner(:owner_len).ne.username(:username_len))) call check_access
c
	open (unit=3,file = old_mail_dir(1:old_mail_dir_len)//'MAIL.MAI',
	1 status='old', shared, form='formatted', readonly,
	1 iostat = mail_stat, organization = 'indexed', access= 'keyed',
	1 recordtype= 'variable')
c
	if (mail_stat.ne.0) goto 1000
c
	read (3,'(q,a)',key=foldername(1:foldername_len),
	1 keyid=1,iostat = mail_stat) q, mail_rec (1:q)
	if (mail_stat.ne.0 ) goto 100
c
	call read_record (q,zeile)
c
50	read (3,'(q,a)',iostat=mail_stat) q,mail_rec(1:q)
c
	if ((mail_stat.ne.0).or.(mail_rec(10:9+foldername_len)
	1.ne.foldername(1:foldername_len))) goto 100
c
	call read_record (q,zeile)
c
	goto 50
c
100	close (3)
	if (zeile.ne.0) write (*,'('' '')')
c
1000	if (zeile.eq.0) then
		call message (1,username,username_len)
	end if
c
	return
c
	end	
$ EOD
$ write sys$output "Creating READ_RECORD.FOR"
$ CREATE READ_RECORD.FOR
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
	subroutine	read_record (q,zeile)
c
	implicit	integer*4 (a-z)
c
	include		'common.txt'
c
	character*23	datum
	integer*4	time(2)
	integer*2	datum_len,zeile
c
	rec_len           = q
	record_pointer    = 64
	absendername      = ' '
	subject    	  = ' '
	absendername_len  = 0
	subject_len       = 0
c
	read (mail_rec(1:),'(a4)') time(1)
	read (mail_rec(5:),'(a4)') time(2)
	stat = sys$asctim(datum_len,datum,time,%val(0))
c
50	if (record_pointer.eq.rec_len) goto 100
c
	read (mail_rec(record_pointer + 1:),'(a2)') block
	record_pointer = record_pointer + 2
c
	read (mail_rec(record_pointer + 1:),'(a2)') block_len
	record_pointer = record_pointer + 2
c
	if (block.eq.'0000'x) then
		absendername = mail_rec(record_pointer + 1:
	1		       record_pointer + 1 + block_len)
		absendername_len = block_len
c
		if (index(absendername,' ').ne.0) then
			absendername = absendername
	1				(1:index(absendername,' '))
			call str$trim
	1		(absendername,absendername,absendername_len)
		end if
c
		if (index(absendername,'::').ne.0) then
			absendername = absendername
	1			(index(absendername,'::')+2:absendername_len)
			call str$trim
	1		(absendername,absendername,absendername_len)
		end if
c
	else if (block.eq.'0002'x) then
		subject     = mail_rec(record_pointer + 1:
	1		      record_pointer + 1 + block_len)
		subject_len = block_len
	end if
c
	record_pointer = record_pointer + block_len
c
	goto 50
c
100	if (alluser_stat.eq.1) goto 200
c
	if ((absendername(1:absendername_len)).eq.
	1(owner(1:owner_len))) then
200		zeile = zeile + 1
		if (zeile.eq.1) then
			write (*,'(/,''  #'',t6,''From'',t26,''Date'',t38,
	1		''Subject'')')
			write (*,'('' ------------------------------------'',
	1		   ''--------------------------------------------'')')
		end if

c
		if (subject_len.gt.42) subject_len = 42
c
		write (*,'('' '',i3,'' '',a,t26,a,t38,a)') zeile,
	1 	absendername(1:absendername_len),datum(1:11),
	1	subject(:subject_len)
c
	end if
c
	return
c
	end
$ EOD
$ write sys$output "Creating READ_SUBDIRECTORY_BLOCK.FOR"
$ CREATE READ_SUBDIRECTORY_BLOCK.FOR
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
	subroutine	read_subdirectory_block
c
	implicit	integer*4 (a-z)
c
	include		'common.txt'
c
	subdirblock	 = block
	subdirblock_len  = block_len
c
	if (subdirblock_len.gt.0) then
		if (default_dir_len.gt.0) then
			old_mail_dir = default_dir (1:default_dir_len-1)//
	1		vmsmail_record (record_pointer + 2 :
	1		record_pointer +
	1		subdirblock_len-1)//']'
			old_mail_dir_len =
	1		old_mail_dir_len + subdirblock_len - 2
c
			subdir = vmsmail_record (record_pointer + 2 :
	1		record_pointer + subdirblock_len - 1)
c
			subdir_len = subdirblock_len - 2
		end if
	end if
c
	return
c
	end	
$ EOD
$ write sys$output "Creating UNREAD.FOR"
$ CREATE UNREAD.FOR
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
	program		unread
c
	implicit 	integer*4 (a-z)
c
	include		'($ssdef)'
	include		'common.txt'
c
c*--------------------------------------------------------------------
c
	english = 0			! Messages in English = 1
c					! Messages in German  = 0
c*--------------------------------------------------------------------
c
	call getowner
c
	if (cli$present ('p1')) then
		stat = cli$get_value ('p1',username,username_len)
	else
		username_len = owner_len
		username = owner
	end if
c
c*--------------------------------------------------------------------
c
10	call getdefault
c
	if (cli$present('all')) alluser_stat = 1
c
c*---------------------------------------------------------------------
c
	open (unit = 2, file =  vmsmailfile, readonly,
	1 status = 'old', shared, organization = 'indexed', access = 'keyed',
	1 iostat = status, form = 'formatted')
c
	if (status.ne.0) then
		call message (3,vmsmailfile,vmsmailfile_len)
		goto 1000
	end if
c
c*----------------------------------------------------------------------
c
	read (2,'(q,a)',iostat=status,key=username,keyid=0)
	1 rec_len,vmsmail_record
c
	close (2)
c
c*----------------------------------------------------------------------
c
	if (status.ne.0) then
		call message (6,username,username_len)
		goto 1000
	end if
c
c--------------------------------------------------------------------------
c
	record_pointer = 31
c
	call getdefdir
c
	old_mail_dir     = default_dir
	old_mail_dir_len = default_dir_len
c
50	if (record_pointer.eq.rec_len) goto 70
c
	read (vmsmail_record(record_pointer + 1:),'(a2)') block
	record_pointer = record_pointer + 2
c
	read (vmsmail_record(record_pointer + 1:),'(a2)') block_len
	record_pointer = record_pointer + 2
c
	if (block.eq.forward_blk) call read_forwardname_block
c
	if (uaf_dir_stat.eq.ss$_normal) then
		if (block.eq.directory_blk) call read_subdirectory_block
	end if
c
	record_pointer = record_pointer + block_len
c
	goto 50
c
c*------------------------------------------------------------------------
c
70	call read_mailfile
c
c*-----------------------------------------------------------------------
c
500	if (forwardname.ne.' ') then
		username_len = forwardname_len
		username = forwardname(:forwardname_len)
		call message (5,forwardname,forwardname_len)
		forwardname = ' '
		goto 10
	end if
c
c*-----------------------------------------------------------------------
c
1000	end
c
$ EOD
$ write sys$output "Creating COMMON.TXT"
$ CREATE COMMON.TXT
$ DECK
c
c  Author:
c
c	Gerhard Lust
c	Geotechnisches Institut
c	Abt. Isotopengeophysik
c	Bundesversuchs- und Forschungsanstalt Arsenal
c	Faradaygasse 3
c	A-1030 Wien
c
c	Tel.: +43/222/782531/518
c	Datexp : PSI%023226191064::SYSTEM
c
c*********************************************************
c	There is no copyright attached to this program.
c	Use it at your own risk.
c*********************************************************
c
c*--------------------------------------------------------------------
c	MAIL.MAI  Parameter_block
c*--------------------------------------------------------------------
c
	common/mail_rec/mail_rec
	character*2048	mail_rec
c
	character*80	absendername,subject
	integer*2	absendername_len,subject_len
c
c*--------------------------------------------------------------------
c
	character*2048	vmsmail_record
	character*32	device,forwardname
	character*31	owner
	character*39	foldername
	character*12	username
	character	default_dir*96,directory*64,subdir*64
	character	old_mail_dir*96
	character*80	vmsmailfile
c
	integer*2	forwardname_len,owner_len
	integer*2	username_len
	integer*2	vmsmailfile_len
	integer*2	device_len,directory_len,default_dir_len
	integer*2	old_mail_dir_len
	integer*2	record_pointer,rec_len
	integer*2	subdir_len,block,block_len
	integer*2	sudirblock,subdirblock_len
	integer*2	forwardnameblock,forwardnameblock_len
	integer*2	directory_blk
	integer*2	forward_blk
	integer*2	flag_blk_len,alluser_stat
c
	integer*4	uaf_dir_stat,mail_stat
	integer*4	foldername_len
	integer*4	priv(2)
c
	byte		english
c
	common/mailman/ username,
	1		owner,
	1		forwardname,
	1		foldername,
	1		personalname,
	1		device,
	1		directory,
	1		default_dir,
	1		old_mail_dir,
	1		vmsmail_record,
	1		vmsmailfile,
	1		subdir,
c
	1		username_len,
	1		owner_len,
	1		forwardname_len,
	1		foldername_len,
	1		vmsmailfile_len,
	1		device_len,
	1		directory_len,
	1		default_dir_len,
	1		old_mail_dir_len,
	1		block,
	1		block_len,
	1		subdirblock,
	1		subdirblock_len,
	1		forwardnameblock,
	1		forwardnameblock_len,
	1		subdir_len,
	1		rec_len,
	1		record_pointer,
	1		uaf_dir_stat,
	1		priv,
	1		mail_stat,
	1		alluser_stat,
	1		english
c
	parameter  (directory_blk            = '0003'x)
	parameter  (forward_blk              = '0004'x)
c
$ EOD
$ write sys$output "Creating UNREAD.CLD"
$ CREATE UNREAD.CLD
$ DECK
ident "Created 89-09-15. BVFA/Lust"
define verb unread

	image sys$system:unread.exe 	! Nach Bedarf aendern

	parameter p1
	qualifier all, nonnegatable
$ EOD
$ write sys$output "Creating UNREAD.DOC"
$ CREATE UNREAD.DOC
$ DECK
-------------------------------------------------------------------------------

			UNREAD - Utility V1.0			15.9.89

-------------------------------------------------------------------------------

					Autor:	Gerhard Lust
						BVFA Arsenal, Wien
						Geotechnisches Institut
						Abt. Isotopengeophysik
						Faradaygasse 3
						A-1030 Wien

						Tel.: +43/222/782531/518
						Datexp: PSI%023226191064::SYSTEM

-------------------------------------------------------------------------------

1.) Allgemeines
---------------

Mit UNREAD ist es moeglich zu kontrollieren, ob ein Benutzer eine Mail die
an ihn adressiert war auch schon gelesen hat. UNREAD ueberprueft den
NEWMAIL- Folder des angegebenen Benutzers auf Mails die vom Absender stammen
und listet ungelesene Mails aus.

*************************************************************************

  !! ACHTUNG: Nur ab VMS V5.0 geeignet.

*************************************************************************

Mit dem Qualifier /ALL koennen aus dem NEWMAIL-Folder des eigenen Mail-Files
sowie der Mail_Files, auf die ein READ- Zugriff erlaubt ist alle,
also auch Mails fremder Absender ohne Privileg gelesen werden.
Benutzer mit dem Privileg SYSPRV erhalten darueber hinaus durch Angabe des
Qualifers /ALL alle Mails fremder NEWMAIL-Folder unabhaengig vom Absender.

Bei Forwardadressen wird zuerst an der angegebenen Adresse nach vorhandenen
Mails gesucht, dann wird an der Forwardadresse weitergesucht.

UNREAD muss mit SYSPRV installiert werden, um allen den Zugriff auf
fremde Mail-Files sowie auf das VMSMAIL_PROFILE zu ermoeglichen.


2.) Aufruf
----------

	$ UNREAD [Username]

3.) Files
---------

UNREAD.INS	--->	Build Prozedur
UNREAD.COM	--->	Installationsprozedur
UNREAD.OLB	--->	Programmlibrary
UNREAD.DOC	--->	Dieses File
UNREAD.HLP      --->	Help Source File
UNREAD.CLD      --->	CLI - File
UNREAD.TXT	--->	Common-File
*.FOR		--->	Alle Programm-Routinen

4.) Installation
----------------

Sie installieren UNREAD in Ihrem System mit @UNREAD. Modifikationen (Pkt.5)
muessen vorher durchgefuehrt werden. Wenn in Ihrem System ein Fortran-Compiler
vorhanden ist, werden alle Files neu kompiliert und gelinkt (sonst wird nur
die vorhandene Object-Library verwendet). Das Help- File wird in die
HELPLIB.HLB eingebaut. UNREAD wird nicht in die DCLTABLES eingebaut (das bleibt
Ihnen ueberlassen), muss aber vor Aufruf als DCL- Kommando bekannt sein
(z.B.:   $ SET COMMAND UNREAD). UNREAD wird mit SYSPRV installiert.

5.) Modifikationen
------------------

Bei gewuenschten Modifikationen in der Installation muss UNREAD.COM
dementsprechend adaptiert werden. Wenn Sie das Image nicht auf SYS$SYSTEM
ablegen wollen, muessen Sie noch UNREAD.CLD modifizieren.
Fuer Probleme und Rueckfragen bin ich unter oben angegebenen Moeglichkeiten
zu erreichen.

Englische Messages erhalten Sie, wenn Sie in UNREAD.FOR der
Variablen "english" den Wert "1" zuweisen.

m.f.G.  G.Lust
$ EOD
$ write sys$output "Creating UNREAD.COM"
$ CREATE UNREAD.COM
$ DECK
$!-------------------------------------------------------------------------
$!	UNREAD - Installationsprozedur
$!-------------------------------------------------------------------------
$!
$	write sys$output "UNREAD Installation- Procedure is working ..."
$!
$ 	on control_y then continue
$!
$ 	curpriv = f$getjpi ("","curpriv")
$!
$	if f$privilege("SYSPRV,CMKRNL").eqs."FALSE".and.-
		f$privilege ("SETPRV").eqs."FALSE"
$	  then
$		write sys$output "SYSPRV and CMKRNL or SETPRV required !! "+-
				 "--> Installation not possible !!"
$		goto finish
$	endif
$!
$ 	if f$privilege ("SYSPRV,CMKRNL").eqs."FALSE" then -
			set proc/priv=(sysprv,cmkrnl)
$!
$ 	install = "$install/command_mode"
$!
$	if f$search ("sys$system:fortran.exe").nes.""
$!
$	  then
$			write sys$output "Compiling all files ...."
$ 		loop:
$			file= f$search ("*.for")
$			if (file.eqs."") then goto loop_end
$			for/nolist 'file
$		goto loop
$!
$		loop_end:
$!
$			if f$search ("unread.olb").eqs.""
$			  then
$				write sys$output "Creating OBJECT-Library ...."
$				libr unread/obj/create
$			  endif
$!
$			write sys$output "Replace OBJECT-Library ...."
$			libr unread/obj/replace *
$!
$	else
$!
$		write sys$output "Fortran-Compiler not found --> "+-
				 "Using old Object-Library"
$		ren [-]unread.olb  []
$		libr unread/obj/extract=unread
$!
$	endif
$!
$	write sys$output "Link UNREAD ..."
$	lin/notrac/nomap unread + unread/libr -
	/execute = sys$system:unread.exe   ! Bei Bedarf aendern
$!
$	write sys$output "Replace UNREAD in HELP-Library ..."
$	libr sys$help:helplib/help/replace unread
$!
$	write sys$output "Purge and delete files ..."
$	del *.obj;*
$!
$	write sys$output "Install - Replace UNREAD"
$	install replace -
  	sys$system:unread/open/shared/header/priv=(sysprv)
$!
$	write sys$output "UNREAD is ready !!"
$!
$ finish:
$!
$ 	set proc/priv=(noall,'curpriv)
$!
$	exit
$ EOD
$ write sys$output "Creating UNREAD.HLP"
$ CREATE UNREAD.HLP
$ DECK
1 UNREAD
			UNREAD - Utility
                      --------------------

  Diese Utility ermoeglicht es festzustellen, ob ein anderer Benutzer
  (Empfaenger) Mails vom Absender (programmaufrufenden Benutzer) schon gelesen
  hat. Es wird eine Liste aller Mails, die der Absender abgeschickt hat und
  vom Empfaenger noch nicht gelesen wurden erstellt.

        Format:

	   $ UNREAD [Empfaengername]
2 Parameter
	Als Parameter wird der zu untersuchende Empfaengename angegeben.
	Default ist der Name des programmaufrufenden Benutzers.

	Format :

	   $ UNREAD

	   $ UNREAD Empfaengername
2 /ALL
	Mit diesem Qualifizierer erhaelt man alle ungelesenen Mails,
	auch die von fremden Absendern. Dieser Qualifizierer ist ohne SYSPRV
	nur dann zulaessig, wenn es sich um das eigene Mail-File handelt bzw.
	wenn READ-Access auf das zu untersuchende Mail-File gestattet ist.

2 Beispiel

	1.) Benutzer MAXI startet folgende Befehlszeile:

	$ UNREAD MORITZ

	   # From	Date        Subject
	-------------------------------------------------------------------
	   1 MAXI	18-JAN-1989 Galgenfrist
	   2 MAXI	24-FEB-1989 Besprechung






	2.) Benutzer MAXI startet folgende Befehlszeile:


	$ UNREAD HUGO

	%UNREAD-I-NOMAIL, Benutzer HUGO hat keine gesuchte Mail.
	%UNREAD-I-FORWD, Mail weitergeleitet zum Benutzer KASPERL .....

	   # From	Date        Subject
	-------------------------------------------------------------------
	   1 MAXI	 7-MAY-1988 Dienstzeit
	   2 MAXI	19-JUL-1988 Feierstunde









	3.) Benutzer MAXI startet folgende Befehlszeile:

	$ UNREAD/ALL

	   # From	Date        Subject
	-------------------------------------------------------------------
	   1 HUGO	 8-JUN-1989 Mittagspause
	   2 GUSTAV	24-AUG-1989 Geisterstunde

$ EOD
$ write sys$output "Read UNREAD.DOC before starting UNREAD.COM !!"
$ exit
