Copyright Digital Equipment Corp. All rights reserved.

Example

   /*
    *   Example mrd_eject(3mrd).
    *
    *   This example is slightly different from the others since it
    *   also demonstrates the Eject Port feature of mrd_eject(3mrd).
    *   This feature can be used on the TL820 family to move a tape
    *   from the Pass-through mechanism (PTM) to the outport.
    *
    *   The command usage is:
    *
    *      mrd_eject robot [ slot port [ volume_tag ] ]
    */
   #ifndef   lint
   static   char   SccsId[] = "@(#)mrd_eject.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_eject(3mrd) */
      char   *robot ;      /* Name of the robot to use */
      char   *volume_tag = NULL ;   /* Volume tag to check */
      char   *slot ;         /* Source slot */
      char   *port ;         /* Destination port */
      char   log_info[MRD_MAX_LOG_STRING+1] ;   /* Error text */

      /*
       *   Allow the command to only have the robot name specified.
       */
      if( argc < 2 ) {
         printf("usage: %s robot [ slot port [ volume_tag ] ]\n",
            argv[0]) ;

         exit(1) ;
      }
      else
         robot = argv[1] ;

      /*
       *   If the slot and port aren't specified assume that
       *   the target robot is a TL820 and fill in default
       *   values for an Eject Port.  Otherwise take the
       *   desired values directly from the command line.
       */
      if( argc >= 4 ) {
         slot = argv[2] ;
         port = argv[3] ;

         /*
          *   Collect the volume_tag name if the user wants it.
          */
         if( argc > 4 )
            volume_tag = argv[4