/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <unistd.h>
#include <signal.h>
#include <strings.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
int
{
fmd_msg_hdl_t *h;
int i, err = 0;
char *s;
if (argc > 1) {
return (2);
}
/*
* Build up a valid list.suspect event for a fictional diagnosis
* using a diagnosis code from our test dictionary so we can format
* messages.
*/
return (1);
}
/* system authority */
"system_mfg");
"system_name");
"system_pn");
"system_sn");
/* component system authority */
"sys_comp_mfg");
"sys_comp_name");
"sys_comp_pn");
"sys_comp_sn");
if (err != 0) {
return (1);
}
if (err != 0) {
return (1);
}
/*
* Add a contrived nvlist array to our list.suspect so that we can
* exercise the expansion syntax for dereferencing nvlist array members
*/
for (i = 0; i < TEST_ARR_SZ; i++) {
return (1);
}
}
if (err != 0) {
return (1);
}
/*
* Now initialize the libfmd_msg library for testing, using the message
* catalogs found in the proto area of the current workspace.
*/
return (1);
}
/*
* Test 0: Verify that both fmd_msg_getitem_id and fmd_msg_gettext_id
* return NULL and EINVAL for an illegal message code, and NULL
* and ENOENT for a valid but not defined message code.
*/
return (1);
}
return (1);
}
return (1);
}
return (1);
}
/*
* Test 1: Use fmd_msg_getitem_id to retrieve the item strings for
* a known message code without having any actual event handle.
*/
for (i = 0; i < FMD_MSG_ITEM_MAX; i++) {
"for %s, item %d: %s\n",
}
free(s);
}
/*
* Test 2: Use fmd_msg_gettext_id to retrieve the complete message for
* a known message code without having any actual event handle.
*/
return (1);
}
(void) printf("%s\n", s);
free(s);
/*
* Test 3: Use fmd_msg_getitem_nv to retrieve the item strings for
* our list.suspect event handle.
*/
for (i = 0; i < FMD_MSG_ITEM_MAX; i++) {
"for %s, item %d: %s\n",
}
free(s);
}
/*
* Test 4: Use fmd_msg_getitem_nv to retrieve the complete message for
* a known message code using our list.suspect event handle.
*/
return (1);
}
(void) printf("%s\n", s);
free(s);
/*
* Test 5: Use fmd_msg_getitem_nv to retrieve the complete message for
* a known message code using our list.suspect event handle, but this
* time set the URL to our own customized URL. Our contrived message
* has been designed to exercise the key aspects of the variable
* expansion syntax.
*/
if (fmd_msg_url_set(h, "http://foo.bar.com/") != 0) {
}
return (1);
}
(void) printf("%s\n", s);
free(s);
for (i = 0; i < TEST_ARR_SZ; i++)
nvlist_free(test_arr[i]);
fmd_msg_fini(h); /* free library state before dumping core */
switch (pid) {
case -1:
return (1);
case 0:
abort();
return (1);
}
return (1);
}
return (1);
}
return (1);
}
return (0);
}