/*
* Example to do slot to slot moves, using mrd_move(3mrd). The
* reason for only doing slot to slot, is that it simplifies
* having to figure out element types. The mrd_position(3mrd)
* example shows how part of this may be done.
*
* The command usage is:
*
* mrd_move source-slot destination-slot [ volume-tag ]
*/
#ifndef lint
static char SccsId[] = "@(#)mrd_move.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_move(3mrd) */
int side = 1 ; /* Only support side one */
char *robot ; /* Name of the robot to use */
char *volume_tag = NULL ; /* Volume tag to check */
char *source ; /* Source slot */
char *destination ; /* Destination slot */
char log_info[MRD_MAX_LOG_STRING+1] ; /* error string */
/*
* Three required arguments; robot name, source slot and
* destination slot.
*/
if( argc < 4 ) {
printf("usage: %s robot src dest [ volume-tag ]\n", argv[0]) ;
exit(1) ;
}
robot = argv[1] ;
source = argv[2] ;
destination = argv[3] ;
/*
* Volume tag is optional.
*/
if( argc > 4 )
volume_tag = argv[4] ;
/*
* Do the operation.
*/
status = mrd_move(robot, volume_tag, source, SLOT, destination,
SLOT, side, log_info) ;
if( status != MRD_STATUS_SUCCESS )
printf("Move failed: %s: %s.\n", mrd_strstatus(status),
log_info[0] ? log_info : "none") ;
else
printf("Moved media from Slot #%s to Slot #%s\n",
source, destination) ;
return 0 ;
}