Using the HP-UX libIO Library
{
hw_path_t hw1, hw2;
int inst=10;
io_token_t node1 ,node2;
char my_string[MAX_HW_PATH_STR];
char my_string1[MAX_HW_PATH_STR];
/*initialize libio operations */
if (io_init(O_RDONLY) == IO_ERROR) {
io_error("ERROR:io_init");
exit(1);
}
if ((node1=io_search((io_token_t)NULL, S_IOTREE_EXT,
Q_SW, "class", "disk", NULL)) == NULL) {
io_error("ERROR:io_search");
exit(1);
}
if (io_query (node1, S_IOTREE_EXT, "hw_path", &hw1)
==IO_ERROR ) {
io_error("ERROR:io_query");
exit(1);
}
if (io_hw_path_to_str(my_string,&hw1)== IO_ERROR) {
io_error("io_hw_path_to_str");
exit(1);
}
if ((node2=io_search((io_token_t)NULL, S_IOTREE, Q_SW,
"class", "disk", NULL)) == NULL) {
io_error("ERROR:io_search");
exit(1);
}
if (io_query (node2, S_IOTREE, "hw_path", &hw2)
==IO_ERROR ) {
io_error("ERROR:io_query");
exit(1);
}
if(io_hw_path_to_str(my_string1,&hw2)== IO_ERROR) {
io_error("io_hw_path_to_str");
exit(1);
}
if (io_hw_compare_ext(&hw1,&hw2) == IO_SUCCESS) {
printf("Hardware path %s and Hardware path %s are
same\n", my_string, my_string1);
} else printf("Hardware path %s and Hardware path %s are
different\n", my_string, my_string1);