HELPLIB.HLB  —  MRD Library, mrd_load, Example
    /*
     *   Example of mrd_load(3mrd).  The command usage is:
     *
     *      mrd_load robot_name slot drive [ volume_tag ]
     */
    #ifndef   lint
    static   char   SccsId[] = "@(#)mrd_load.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_load(3mrd) */
       short   side = 1 ;      /* Only support single sided media */
       char   *robot ;      /* The name of the robot */
       char   *volume_tag = NULL ;   /* Optional volume tag to check */
       char   *slot ;         /* Source slot */
       char   *drive ;      /* Destination drive */
       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 slot drive [ volume-tag ]\n", argv[0]);
          exit(1) ;
       }

       /*
        *   Just use these directly from the command line.
        */
       robot  = argv[1] ;
       slot   = argv[2] ;
       drive  = argv[3] ;

       /*
        *   If the volume tag is present use it.
        */
       if( argc > 4 )
          volume_tag = argv[4] ;

       /*
        *   Call the function.
        */
       status = mrd_load(robot, volume_tag, slot, side, drive, log_info);

       /*
        *   Print an error message if there is a failure.
        */
       if( status != MRD_STATUS_SUCCESS )
          printf("Load failed: %s: %s.\n", mrd_strstatus(status),
             log_info[0] ? log_info : "none") ;
       else
          printf("Loaded media in Slot #%s to Drive #%s\n",
             slot, drive) ;

       return 0 ;
    }
Close Help