M In article <19@mixcom.UUCP>, oovvoo@mixcom.UUCP (Michael W. Shawaluk) writes: H > I am developing a program in C, which outputs a number of error and/orN > informational messages via LIB$SIGNAL and the MESSAGE facility (i.e., I haveK > a .MSG file which I "compile" with the MESSAGE command, and I "globalref" F > all of the symbols which I want to reference in the messages).  ThisK > technique works fine, except that there are a couple of cases in which it H > would be handy to output these messages without the trailing CR's thatN > LIB$SIGNAL seems to insist on putting there (one example is a confirmationalK > prompt, much like the "are you sure?" message that DELETE/CONFIRM gives). H > So my question is, is there an easy way to do this, and still have theL > benefit of defining the message text via the .MSG file?  I must confess toM > not being really up on all of the various FAO directives and options, and I 7 > apologize in advance if I'm missing something simple.  > L > Thanks in advance; feel free to email and/or post any suitable suggestions > or comments. > 	 > 	- Mike   H You can use the SYS$GETMSG system service routine to get the text of theA message, and then use SYS$FAO or SYS$FAOL to translate any of the K parameters.  This isn't too difficult a proposition.  In fact, here are two J routines that I use (one is in VAXC and the other in VAX MACRO) to use theH message facility from VAXC.  I apoligize if this is too long for some of you.  O =============================================================================== 	 	CUT HERE O =============================================================================== O /******************************************************************************   *  *  File:		Lexicals.H   *  Author:		David R. Potter  *  Creation Date:	12-Aug-1987  *O  ******************************************************************************   *  *  Description:  *F  *	This file contains definitions for use with the f_message function.  *P  ******************************************************************************/  - /*** Constants for use with f_message(): ***/   6 #define	F_MSGTEXT	0x01		/* Include text of message.	*/8 #define	F_MSGID		0x02		/* Include message identifier.	*/8 #define	F_MSGSEV	0x04		/* Include severity indicator.	*/3 #define	F_MSGFAC	0x08		/* Include facility name.	*/   : extern	int	f_message( long, char *, long, unsigned long );/ extern	int	f_fao( char *, char *, uword, ... ); O =============================================================================== 	 	CUT HERE O =============================================================================== O /******************************************************************************   *  *  File:		F_Message.C  *  Author:		David R. Potter  *  Creation Date:	12-Aug-1987  *O  ******************************************************************************   *  *  Description:  *F  *	This function will operate like the DCL F$MESSAGE lexical function.F  *	This function will obtain the message associated with an error codeB  *	returned by system services, RTL functions, RMS functions, etc.  *  *  Inputs: ;  *	lErrCode	The error code whose message is to be returned. A  *	pszMsg		The address of a string in which to place the message.   *	lBufSize	The size of pszMsg. B  *	ulMsgFlags	Code indicating which parts of the message are to be;  *			  returned.  The following mask values are acceptable: -  *			    F_MSGTEXT	= Return the message text. 1  *			    F_MSGID	= Return the message identifier. :  *			    F_MSGSEV	= Return the message severity indicator.5  *			    F_MSGFAC	= Return the message facility name. ;  *			  If 0 is specified, the process default flags will be   *			  used.  *  *  Outputs:  *	pszMsg		The desired message.   *  *  Returns:#  *	Sts		The status from sys$getmsg.   *P  ******************************************************************************/   #include	<ctype.h> #include	<descrip.h> #include	<ssdef.h> #include	"f_message.h"  O /******************************************************************************   */  *  f_message		Get the Message from SYS$GETMSG.   *P  ******************************************************************************/  
 int f_message  	( long		lErrCode  	, char		*pszMsg 	, long		lBufSize  	, unsigned long	ulMsgFlags  	) {  	/* VARIABLES */- 	int		Sts;			/* Status from function calls.*/ 1 	word		wMsgLen;		/* Returned length of message.*/ 7 	char		abMsgStuff[4];		/* Output information from    */ ! 						 *   SYS$Getmsg().	      */  #pragma nostandard? 	$DESCRIPTOR( dMsg, pszMsg );		/* Message buffer descriptor. */  #pragma standard  ) 	/*** Set descriptor for getmsg call. *** * 	 *** Make sure buffer is big enough. ***/   	if ( lBufSize > 1 )& 	    dMsg.dsc$w_length = lBufSize - 1; 	else  	    return( SS$_BUFFEROVF );    	/*** Get the message. ***/    	Sts = SYS$Getmsg ( 		( lErrCode			/*   Message ID.	      *// 		, &wMsgLen			/*   Output length variable.  */ - 		, &dMsg				/*   Output buffer descriptor.*/ 1 		, ulMsgFlags			/*   Message component flags. */ 1 		, abMsgStuff			/*   Optional info address.   */  		);  6 	/*** Null terminate the message if it was found. ***/   	if ( ERROR( Sts ) ) 	    pszMsg[0] = '\0';   	else  	    {> 	    pszMsg[wMsgLen] = '\0';		/* Null terminate message.    */  A 	    /*** If first character is not a %, only the message     *** B 	     *** text was returned.  Capitalize the first character. ***/   	    if ( pszMsg[0] != '%' )$ 		pszMsg[0] = _toupper( pszMsg[0] );  ) 	    }  /* else:  message was returned */    	/*** Return the status. ***/    	return( Sts );  	    }  /*** f_message() ***/O =============================================================================== 	 	CUT HERE O =============================================================================== & 	.TITLE	F_FAO Function Callable From C 	.IDENT	"V1.2.0"  O ;------------------------------------------------------------------------------  ;  ;   File:		F_Fao.Mar ;   Author:		David R. Potter ;   Creation Date:	21-Sep-1990 ; O ;------------------------------------------------------------------------------  ;  ;   Description: ; H ;	This function implements the FAO system routine from a C program using ;	null-terminated strings. ; 	 ;   Call: 6 ;	int = F_Fao( pszControl, pszOutStr, uwOutLen, ... ); ;  ;   Inputs: = ;	4(ap)		<pszControl>	The address of a null-terminated string * ;					  containing the FAO control string.: ;	8(ap)		<pszOutStr>	The address of a string into which to- ;					  write the result as a null-terminated  ;					  string. < ;	12(ap)		<uwMaxLen>	A word specifying the maximum length of- ;					  the output string.  The value used in - ;					  the call to FAO will be one less than ) ;					  this value to allow for the null-  ;					  termination.& ;	16(ap) et. al.			The FAO parameters. ;  ;   Outputs:0 ;	<pszOutStr>			The output string from FAO null-, ;					  terminated.  If an error occurs, the% ;					  first character will be null.  ;  ;   Return:   ;	Any condition values from FAO. ;   O ;------------------------------------------------------------------------------  ; ! ;   f_fao	C Interface To SYS$Fao.  ; O ;------------------------------------------------------------------------------   @ 	.PSECT	F_FAO,	PIC, CON, REL, GBL,   SHR,   EXE, RD, NOWRT, LONG 	.ENTRY	f_fao, ^M<R2, R3>   
 ; Parameters:  pszControl	= 4
 pszOutStr	= 8 
 uwMaxLen	= 12   , ; Set aside stack space for local variables:3 dControl	= -8			; Desriptor for the control string. 4 dOutStr		= -16			; Descriptor for the output string.8 uwOutLen	= -18			; Length of the output string from FAO.  
 	subl	#20, sp   + ; Initialize the output string to be empty.   8 	movb	#0, @pszOutStr(AP)		; Initialize the output string 						;   to empty.   ( ; Find the length of the control string.  6 	pushl	pszControl(AP)			; Push the string whose length 						;   is to be obtained.' 	calls	#1, g^STRLEN			; Get its length.    ; Setup the descriptors.  / 	movw	R0, dControl(FP)		; Set the length of the  						;   descriptor. 7 	clrw	<dControl+2>(FP)		; Clear out the type and class. > 	movl	pszControl(AP), <dControl+4>(FP); Set the address of the 						;   control string.   ; 	subw3	#1,uwMaxLen(AP), dOutStr(FP)	; Set the length of the  						;   descriptor. 7 	clrw	<dOutStr+2>(FP)			; Clear out the type and class. D 	movl	pszOutStr(AP), <dOutStr+4>(FP)	; Set the address of the output 						;   string.   / ; Push the FAO parameters onto the stack first.   1 	rotl	#2, (AP), R2			; Get the offset to the last  						;   parameter.3 	addl3	AP, R2, R3			; Get the actual address of the  						;   parameter.) 	tstl	(R3)+				; Point past the last one.  10$:. 	cmpl	R2, #uwMaxLen			; Are there any more FAO 						;   parameters?  	beql	20$				; Branch if not. - 	pushl	-(R3)				; Push the parameter onto the $ 						;   stack for the call to FAO./ 	subl	#4, R2				; Decrement the current offset. % 	brb	10$				; Get the next parameter.   H ; Call FAO.  The AP register happens to contain the number of parameters ; required for the call to FAO.  20$:/ 	pushaq	dOutStr(FP)			; Push the address of the # 						;   output string descriptor. 0 	pushaw	uwOutLen(FP)			; Push the address of the 						;   output length word. 0 	pushaq	dControl(FP)			; Push the address of the$ 						;   control string descriptor.$ 	calls	(AP), g^SYS$FAO			; Call FAO./ 	blbc	R0, 30$				; Branch if an error occurred.   # ; Null terminate the output string.   6 	movw	uwOutLen(FP), R2		; Get the offset to the end of 						;   the output string.7 	movl	pszOutStr(AP),R3		; Get the address of the output  						;   string buffer.- 	clrb	(R3)[R2]			; Null-terminate the string.  30$:  	ret					; Return to the caller.  O ;------------------------------------------------------------------------------    	.END O =============================================================================== 	 	CUT HERE O ===============================================================================  --  3   David Potter                Voice: (714) 970-1515 H   Data Processing Design      UUCP: {lawnet,zardoz,dhw68k}!dpdvax!potter:   Anaheim, CA                 Internet: potter@dpdvax.uucp /* ---------- */  