forked from IBM/db2-samples
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathasnmail.smp
105 lines (96 loc) · 5.71 KB
/
asnmail.smp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*********************************************************************/
/* */
/* IBM Replication Monitor User Exit */
/* */
/* ASNMAIL sample program */
/* */
/* Licensed Materials - Property of IBM */
/* */
/* (C) Copyright IBM Corp. 2002 All Rights Reserved */
/* */
/* US Government Users Restricted Rights - Use, duplication */
/* or disclosure restricted by GSA ADP Schedule Contract */
/* with IBM Corp. */
/* */
/*********************************************************************/
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
/* PLEASE READ THE FOLLOWING BEFORE PROCEEDING... */
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
/*********************************************************************/
/* */
/* ASNMAIL is invoked by the Monitor program if a */
/* notification eMail have to be sended. */
/* The ASNMAIL programm expects at least four parameters: */
/* 1. The EMAIL_SERVER parameter for asnmon */
/* 2. The recipient e-mail address */
/* 3. The subject of the note */
/* 4. The first line of the message */
/* may follow */
/* */
/* Example: */
/* */
/* asnmail "smtpserver.com" "[email protected]" */
/* "Alerts issued" "Fist line of node" */
/* "second line of note" */
/* */
/* For building this file rename this file to asnmail.C */
/* The executable file must be named asnmail */
/*********************************************************************/
/* */
/* Installing the ASNMAIL program: */
/* ------------------------------------- */
/* - place ASNMAIL in a directory which is in the search path */
/* for programs and commands specified by the PATH environment */
/* variable. */
/* */
/*********************************************************************/
/* */
/* */
/* */
/* NOTICE TO USERS OF THE SOURCE CODE EXAMPLE */
/* */
/* INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THE SOURCE */
/* CODE EXAMPLE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER */
/* EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED */
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE */
/* SOURCE CODE EXAMPLE IS WITH YOU. SHOULD ANY PART OF THE SOURCE */
/* CODE EXAMPLE PROVES DEFECTIVE, YOU (AND NOT IBM) ASSUME THE */
/* ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. */
/* */
/*********************************************************************/
/*********************************************************************/
/* include files */
/*********************************************************************/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
/*********************************************************************/
/* define */
/*********************************************************************/
#define SUCCESS 0
#define WRONG_PARAMETER_COUNT 1
/*********************************************************************/
/* main */
/*********************************************************************/
int main(int arg_count, char *args[])
{
int rc = SUCCESS;
int index; /* index for arguments */
if (arg_count < 4)
{
rc = WRONG_PARAMETER_COUNT);
}
else
{
/* args[1] contains the email_server parameter from asnmon */
/* args[2] contains the e-mail address of the recipient */
/* args[3] contains the subject of the note */
/* You can place your code in the following loop: */
for (index=4; index < arg_count; index++ )
{
/* args[index] points to each line of the note */
} /* for */
} /* if */
return rc;
}