/****************************************************************
* myjuke.c *
* *
* modified by reason *
* -------- -- ------ *
* 06-May-93 cbl original, keeps jukebox *
* commands local to this routine. *
* loads tape, reads lable and *
* unloads tape. *
* *
* command - 0 load tape from slot into drive *
* 1 unlaod tape and return to slot. *
* *
****************************************************************/
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <rpc/rpc.h>
#include "jukeclnt.h"
#define DEVICE "juke0"
int
myjuke(char *chdrive,JGP_LOCATION slot,int command)
{
int istat; /* status of operation. */
JCL_HANDLE ch; /* channel for jukebox operations. */
JGP_LOCATION drive; /* drive for use. */
extern int check_juke(long int status);
int iret; /* return status from call. */
iret=0; /* assume success. */
/* Open a channel to the jukebox for communications. */
if(juke_check(jcl_open(DEVICE,&ch)) == 0)
{
/******************************************************
* convert drive to location *
******************************************************/
juke_check(jcl_drive2loc(ch,chdrive,&drive));
if (command == 0 ) {
if(FAILED(jcl_load(ch,drive,slot))) iret=-1;
} else {
iret=juke_check(jcl_unload(ch,drive,slot));
}
istat=jcl_close(ch); /* close device when done */
} else {
printf("\n MyJuke-F-Open Failed %d\n",istat);
}
return(iret);
}