HELPLIB.HLB  —  MRD Library, mrd_init_element, Example
    /*
     *   Example of mrd_initialize_element(3mrd).  The command usage is:
     *
     *   Usage:
     *
     *      mrd_initialize_element robot [ robot... ]
     *      robot_name
     *
     *   It has been observed on an empty TL820 with all the bin-packs
     *   in place that this command takes just under 23 minutes.
     */
    #ifndef   lint
    static char SccsId[] = "@(#)mrd_initialize_element.c 1.3) 6/20/97";
    #endif

    #include <stdio.h>
    #include <stdlib.h>
    #include <mrd_common.h>
    #include <mrd_message.h>

    main(int argc, char *argv[])
    {
       int      rc ;
       int      status ;   /* return status */
       char      *robot ;   /* Robot to open */
       robot_info_t   robot_info ;   /* Robot data */
       dev_status_t   dev_status ;   /* Device status */
       char      log_info[MRD_MAX_LOG_STRING+1] ;

       /*
        *   Check that there are enough arguments.
        */
       if( argc < 4 ) {
          printf("usage: %s robot [ robot... ]\n", argv[0]) ;
          exit(1) ;
       }

       /*
        *   Initialize the channel field of the robot_info, so
        *   mrd_startup(3mrd) will actually open the robot.
        */
       robot_info.channel = BAD_CHANNEL ;

       for(rc = 1; rc < argc; rc++) {
          /*
           *   Save the current robot name.
           */
          robot = argv[rc] ;

          status = mrd_startup(robot, &robot_info, log_info) ;

          if( status != MRD_STATUS_SUCCESS ) {
             printf("Startup failed: %s: %s.\n",
                mrd_strstatus(status),
                log_info[0] ? log_info : "none") ;

             continue ;
          }

          printf("Initialize Element Status on %s...", robot) ;
          fflush(stdout) ;

          status = mrd_initialize_element(&robot_info, &dev_status) ;

          if( status != MRD_STATUS_SUCCESS )
             printf("Failed: %s.\n", mrd_strstatus(status)) ;
          else
             printf("Success.\n") ;

          (void)mrd_shutdown(&robot_info) ;
       }

       return 0 ;
    }
Close Help