/*
* Example of using mrd_startup(3mrd) and mrd_shutdown(3mrd). This
* just opens the robot and prints the element counts and Inquiry
* string. The command usage is:
*
* mrd_startup robot
*/
#ifndef lint
static char SccsId[] = "@(#)mrd_startup.c 1.2 3/5/97" ;
#endif
#include <stdio.h>
#include <stdlib.h>
#include <mrd_common.h>
#include <mrd_message.h>
main(int argc, char *argv[])
{
robot_info_t robot_info ; /* Place to put robot data */
int status ; /* status from mrd_startup(3mrd) */
char *robot ; /* robot name */
char log_info[MRD_MAX_LOG_STRING+1] ; /* error text */
/*
* Only one required argument; the robot name
*/
if( argc == 1 ) {
printf("usage: %s robot\n", argv[0]) ;
exit(1) ;
}
else
robot = argv[1] ;
/*
* The channel number must be set to BAD_CHANNEL before
* mrd_startup is called, otherwise it will assume the
* robot is already open and not try to open it again.
*/
robot_info.channel = BAD_CHANNEL ;
status = mrd_startup(robot, &robot_info, log_info) ;
if( status != MRD_STATUS_SUCCESS )
printf("Startup failed: %s: %s.\n", mrd_strstatus(status),
log_info[0] ? log_info : "none") ;
else {
printf("Inquiry: %s\n", robot_info.inquiry) ;
printf(" Transports: %d\n", robot_info.transport_count) ;
printf(" Slots: %d\n", robot_info.slot_count) ;
printf(" Ports: %d\n", robot_info.port_count) ;
printf(" Drives: %d\n", robot_info.device_count) ;
}
(void)mrd_shutdown(&robot_info) ;
return 0 ;
}