/*
* Example of mrd_inject(3mrd). The command usage is:
*
* mrd_inject robot_name port slot [ volume_tag ]
*/
#ifndef lint
static char SccsId[] = "@(#)mrd_inject.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[])
{
int status ; /* Status from mrd_inject(3mrd) */
char *robot ; /* The name of the robot */
char *volume_tag = NULL ; /* Optional volume tag to check */
char *port ; /* Source port */
char *slot ; /* Destination slot */
char log_info[MRD_MAX_LOG_STRING+1] ; /* error string */
/*
* Accept three required argument; robot, port and slot. The
* volume tag is optional.
*/
if( argc < 4 ) {
printf("usage: %s robot port slot [ volume-tag ]\n", argv[0]);
exit(1) ;
}
/*
* Just use these directly from the command line.
*/
robot = argv[1] ;
port = argv[2] ;
slot = argv[3] ;
/*
* If the volume tag is present use it.
*/
if( argc > 4 )
volume_tag = argv[4] ;
/*
* Call the function.
*/
status = mrd_inject(robot, volume_tag, port, slot, log_info) ;
/*
* Print an error message if there is a failure.
*/
if( status != MRD_STATUS_SUCCESS )
printf("Inject failed: %s: %s.\n", mrd_strstatus(status),
log_info[0] ? log_info : "none") ;
else
printf("Injected media from Port #%s to Slot #%s.\n",
port, slot) ;
return 0 ;
}