| Previous | Contents | Index |
The programs shown in Examples 2-4 and 2-5 illustrate the use of the PMDF_HDRMSG_FILE and PMDF_HDR_ADDRS item codes to enqueue a message which has already been composed --- headers and all --- and stored in a file. Example 2-6 shows input file. The resulting message is shown in Example 2-7.
When the entire message, header and body, is contained in a single file, use the PMDF_HDRMSG_FILE item code in place of the PMDF_HDR_FILE and PMDF_MSG_FILE item codes.
| Example 2-4 Specifying an Initial Message Header (Pascal) |
|---|
(* send_example3.pas -- Send a message with initial header *)
[inherit ('pmdf_exe:apidef')] program send_example3;
var
item_index : integer := 0;
item_list : array [1..3] of PMDF_item_list;
msgfile : varying [40] of char := 'PMDF_ROOT:[DOC.EXAMPLES]EXAMPLE.TXT';
function SYS$EXIT (%immed status : integer := %immed 1) : integer; extern;
(* Push an option oriented entry onto the item list *)
procedure push_opt (code : integer);
begin (* push_opt *)
item_index := succ (item_index);
with item_list[item_index] do begin
item_code := code;
item_address := nil;
item_length := 0;
end; (* with *)
end; (* push_opt *)
(* Push an string oriented entry onto the item list *)
procedure push_str (code : integer; var str : varying [len] of char);
begin (* push_str *)
item_index := succ (item_index);
with item_list[item_index] do begin
item_code := code;
item_address := (iaddress (str.body))::$stringptr;
item_length := str.length;
end; (* with *)
end; (* push_str *)
begin (* send_example3 *)
push_opt (PMDF_HDR_ADDRS);
push_str (PMDF_HDRMSG_FILE, msgfile);
push_opt (PMDF_END_LIST);
SYS$EXIT (PMDF_send ((iaddress (item_list))::PMDF_item_list_ptr));
end. (* send_example3 *)
|
| Example 2-5 Specifying an Initial Message Header (C) |
|---|
/* send_example4.c -- Send a message with initial header */
#ifdef __VMS
#include "pmdf_com:apidef.h"
#else
#include "/pmdf/include/apidef.h"
#endif
/* Push an entry onto the item list */
#define ITEM(item,adr,len) item_list[item_index].item_code = (item); \
item_list[item_index].item_address = (char *)(adr); \
item_list[item_index].item_length = (len); \
item_index++
main ()
{
PMDF_item_list item_list[3];
int item_index = 0;
#ifdef __VMS
char *msgfile = "PMDF_ROOT:[DOC.EXAMPLES]EXAMPLE.TXT";
#else
char *msgfile = "/pmdf/doc/examples/example.txt";
#endif
ITEM (PMDF_HDR_ADDRS, 0, 0);
ITEM (PMDF_HDRMSG_FILE, msgfile, strlen (msgfile));
ITEM (PMDF_END_LIST, 0, 0);
exit (PMDF_send (&item_list));
}
|
| Example 2-6 Input File Used in Examples 2-4 and 2-5 |
|---|
Subject: PMDF callable SEND example To: system@sigurd.yourstruely.com Message-id: <01GPKFNPUQF89LV1WX@sigurd.yourstruely.com> MIME-version: 1.0 Content-type: TEXT/PLAIN; CHARSET=US-ASCII Content-transfer-encoding: 7BIT Comments: Ignore this message -- it's just a test This is a test of the emergency broadcasting system! 12345678901234567890123456789012345678901234567890123456789012345678901234567890 00000000011111111112222222222333333333344444444445555555555666666666677777777778 |
| Example 2-7 Output of Examples 2-4 and 2-5 |
|---|
Date: 04 Oct 2012 22:42:25 -0700 (PDT) From: system@sigurd.yourstruely.com Subject: PMDF callable SEND example To: system@sigurd.yourstruely.com Message-id: <01GPKFNPUQF89LV1WX@sigurd.yourstruely.com> MIME-version: 1.0 Content-type: TEXT/PLAIN; CHARSET=US-ASCII Content-transfer-encoding: 7BIT Comments: Ignore this message -- it's just a test This is a test of the emergency broadcasting system! 12345678901234567890123456789012345678901234567890123456789012345678901234567890 00000000011111111112222222222333333333344444444445555555555666666666677777777778 |
| Previous | Next | Contents | Index |