tldm-universe/Ardent/UV/APP.PROGS/MESSAGE.B
2024-09-09 17:51:08 -04:00

106 lines
3.2 KiB
Brainfuck
Executable File

********************************************************************************
*
* Support of PR1ME INFORMATION subroutine '!MESSAGE'
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software Inc.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description.........................................
* 10/14/98 23801 SAP Change copyrights.
* 03/13/96 17797 AGM Replace 'SH -c' with OS.EXEC
* 01/19/94 12299 LA Fixed single user status and now returns a status
* code.
* 10/08/93 12299 LA Initial implementation.
*
*******************************************************************************
* START-DESCRIPTION:
*
* The syntax for the !MESSAGE subroutine is:
*
* CALL !MESSAGE(KEY, USERNAME, USERNUMBER, MESSAGE, STATUS)
*
* Where:
*
* KEY (I) is one of: IK$MSGACCEPT - set message status to accept
* IK$MSGDEFER - set message status to defer
* IK$MSGREJECT - set message status to reject
* IK$MSGSEND - send message to user
* IK$MSGSENDNOW - send message to user now
* IK$MSGSTATUS - display message status of user
* USERNAME (I) the name of the user or terminal for send/status operations
* USERNO (I) PID of user for send/status operations
* MESSAGE (I) message to be sent. Should be null for operations other
* than IK$MSGSEND or IK$MSGSENDNOW
* STATUS (O) status of the operation:
* 0 = success
* IE$NOSUPPORT = Unsupported key option
* IE$KEY = Invalid key given
* IE$PAR = Bad parameters given
* IE$UNKNOWN_USER = Unknown user when sending message
*
* The subroutine is implemented by calling the uniVerse message program
*
* END-DESCRIPTION
$OPTIONS DEFAULT
subroutine PR1ME(KEY, USERNAME, USERNUMBER, MESSAGE, STATUS)
$INCLUDE UNIVERSE.INCLUDE INFO_KEYS.H
$INCLUDE UNIVERSE.INCLUDE INFO_ERRS.H
$INCLUDE UNIVERSE.INCLUDE FILENAMES.H
$INCLUDE UNIVERSE.INCLUDE MACHINE.NAME
STATUS = 0
CMD = OS.EXEC:" '":UV.ROOT:"/bin/message "
* Validate input arguments as far as possible. For the moment, can't
* use usernumber as an identification, just username/ttyname
IF USERNAME = "" AND USERNUMBER NE "" THEN
STATUS = IE$NOSUPPORT
GOTO EXIT.MESSAGE
END
BEGIN CASE
CASE KEY = IK$MSGDEFER
STATUS = IE$NOSUPPORT
CASE KEY = IK$MSGSEND OR KEY = IK$MSGSENDNOW
IF MESSAGE = "" THEN STATUS = IE$PAR
ELSE
CMD := USERNAME:' -BRIEF -MSG "':MESSAGE:'"'
END
CASE KEY = IK$MSGACCEPT
CMD := USERNAME:" -BRIEF -ACCEPT"
CASE KEY = IK$MSGREJECT
CMD := USERNAME:" -BRIEF -REJECT"
CASE KEY = IK$MSGSTATUS
IF USERNAME NE "" THEN
CMD := USERNAME:" -STATUS"
END ELSE
CMD := " -STATUS"
END
CASE 1
STATUS = IE$KEY
END CASE
IF STATUS = 0 THEN
CMD := "'"
IF KEY = IK$MSGSEND OR KEY = IK$MSGSENDNOW THEN
EXECUTE CMD CAPTURING STATUS
END ELSE EXECUTE CMD
END
EXIT.MESSAGE:
RETURN