	PROGRAM NETMAIL
	IMPLICIT INTEGER(A-Z)
	INTEGER*4 icode
	CHARACTER running_user*31, original_user*31, cmd_type*6
	CHARACTER*256 options(4)
	LOGICAL updating
	COMMON original_user
	COMMON updating
	PARAMETER (LIB$M_CLI_CTRLY = '02000000'X)
C
C	Display version number.
C
	CALL LIB$PUT_OUTPUT(' ')
	CALL LIB$PUT_OUTPUT('Netmail Version 1.0  11-Feb-1986')
	CALL LIB$PUT_OUTPUT(' ')
C
C	Disable CTRL-Y.
C
	icode = LIB$DISABLE_CTRL(lib$m_cli_ctrly)
	if (.not.icode) CALL LIB$STOP(%val(icode))
C
C	Get the running user's account.
C
	CALL GET_USERNAME(running_user)
	original_user = running_user
C
C	Setup Break Traps.
C
	CALL SETTRAP
C
C	Get command wanted.
C
	CALL GETCMD(cmd_type,options)
C
C	Setup EXIT handler.
C
	CALL SETEXIT
C
C	Set username to NETMAIL for access to VMSMAIL file via proxy.
C
	CALL SET_USER('NETMAIL')
C
C	If SHOW option selected, go show what user wanted.
C
	If((cmd_type(1:4).eq.'SHOW').or.(cmd_type(1:4).eq.'LIST')
     +      .or.(cmd_type.eq.'COMPAR'))
     +    CALL SHOWINFO(running_user,cmd_type,options)
C
C	If SET/DELETE option selected, go set what user wanted.
C
	If((cmd_type(1:3).eq.'SET').or.(cmd_type.eq.'DELETE')) then
	updating = .true.
	CALL SETINFO(running_user,cmd_type,options)
	Endif
C
C	Reset username to original and enable CTRL-Y.
C
	CALL SET_USER(original_user)
	icode = LIB$ENABLE_CTRL(lib$m_cli_ctrly)
	if (.not.icode) CALL LIB$STOP(%val(icode))
C
	end
