From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 13-APR-1994 17:29:44.54
To:	EVERHART
CC:	
Subj:	Re: breakthrough call..Why?

From: wayne@tachyon.com (Wayne Sewell)
X-Newsgroups: comp.os.vms
Subject: Re: breakthrough call..Why?
Message-ID: <1994Apr13.092429.1341@tachyon.com>
Date: 13 Apr 94 09:24:29 CDT
Organization: Tachyon Software Consulting
Lines: 158
To: Info-VAX@CRVAX.SRI.COM
X-Gateway-Source-Info: USENET

In article <2ofg8q$12f@goanna.cs.rmit.oz.au>, s9312688@pitvax.xx.rmit.edu.au writes:
> Can someone please e-mail me some example code for using the BREAKTHOUGH call.
> please only C or ADA..
> 
> regards..
> 
> --
> Ross Irvine	s9312688@Pitvax.Xx.Rmit.Edu.Au  (VAX 6000-420)
> 		s9312688@Minyos.Xx.Rmit.Edu.Au  (Encore Multimax 520)
> 		s9312688@Arcadia.Cs.Rmit.Edu.Au (Sun SparcStation 10/30)



#include <string>
#include <stdio>
#include <starlet>
#include <descrip>
#include <brkdef>

typedef struct { unsigned short int sts, len; 
                 unsigned int val; } Iosb;

/************************************************************************/
/*									*/
/* send_message_to_terms_or_users(which,which_buff,message_buff)	*/
/*									*/
/************************************************************************/


int send_message_to_terms_or_users(int which, char which_buff[], 
				char message_buff[])

{
Iosb the_iosb;				/* i/o status block */
struct dsc$descriptor message_desc;
struct dsc$descriptor which_desc;
int status,i;

/* set up user or term name descriptor */

which_desc.dsc$b_dtype = DSC$K_DTYPE_T;
which_desc.dsc$b_class = DSC$K_CLASS_S;
which_desc.dsc$a_pointer = which_buff;
which_desc.dsc$w_length = strlen(which_buff);

/* set up message descriptor */

message_desc.dsc$b_dtype = DSC$K_DTYPE_T;
message_desc.dsc$b_class = DSC$K_CLASS_S;
message_desc.dsc$a_pointer = message_buff;
message_desc.dsc$w_length = strlen(message_buff);

/* send the message */

status = sys$brkthruw(0,&message_desc,&which_desc,which,&the_iosb,
			0,0,0,10,0,0);
if (!(status & 1)) return status;
return the_iosb.sts;
}

/************************************************************************/
/*									*/
/* send_message_by_user_name(user_name_buff,message_buff)		*/
/*									*/
/************************************************************************/


int send_message_by_user_name(char user_name_buff[], char message_buff[])

{
int status,i;

/* send the message */
status = send_message_to_terms_or_users(BRK$C_USERNAME, 
                         	user_name_buff, message_buff);
return status;
}


/************************************************************************/
/*									*/
/* send_message_by_terminal_name(terminal_name_buff,message_buff) 	*/
/*									*/
/************************************************************************/


int send_message_by_terminal_name(char terminal_name_buff[], 
			char message_buff[])

{
int status,i;

/* send the message */
status = send_message_to_terms_or_users(BRK$C_DEVICE, 
                         	terminal_name_buff, message_buff);
return status;
}

/************************************************************************/
/*									*/
/* send_message_to_all_users(message_buff) 				*/
/*									*/
/************************************************************************/


int send_message_to_all_users(char message_buff[])

{
int status,i;

/* send the message */
status = send_message_to_terms_or_users(BRK$C_ALLUSERS, 
                         	"", message_buff);
return status;
}


/************************************************************************/
/*									*/
/* send_message_to_all_terminals(message_buff) 				*/
/*									*/
/************************************************************************/


int send_message_to_all_terminals(char message_buff[])

{
int status,i;

/* send the message */
status = send_message_to_terms_or_users(BRK$C_ALLTERMS, 
                         	"", message_buff);
return status;
}


int main (void) 

{
char out_message[1024];
int status;

sprintf(out_message, "\r\n\n\7 Whoop de do\n\n");

status = send_message_by_user_name ("WAYNE",out_message);

return status;
}


-- 
==============================================================================
Wayne Sewell                            |INET: wayne@tachyon.com
Tachyon Software Consulting             |UUCP: uupsi!uupsi6!tachyon!wayne
P. O. Box 550937, Dallas TX  75355-0937 |Voice: (214)-553-9760, Fax: -553-0077
=============================================================================
Domina(old bat):"A common flesh peddler in the house next door!  Disgusting!"
Senex(her husband):"Yes, all that revolting flesh...just next door."  

