src/stored/autochanger.c
bool init_autochangers()
{
   bool OK = true;
   AUTOCHANGER *changer;
   /* Ensure that the media_type for each device is the same */
   foreach_res(changer, R_AUTOCHANGER) {
      DEVRES *device;
      foreach_alist(device, changer->device) {
         /*
          * If the device does not have a changer name or changer command
          *   defined, use the one from the Autochanger resource
          */
         if (!device->changer_name && changer->changer_name) {
            device->changer_name = bstrdup(changer->changer_name);
         }
         if (!device->changer_command && changer->changer_command) {
            device->changer_command = bstrdup(changer->changer_command);
         }
         if (!device->changer_name) {
            Jmsg(NULL, M_ERROR, 0,
               _("No Changer Name given for device %s. Cannot continue.\n"),
               device->hdr.name);
            OK = false;
         }
         if (!device->changer_command) {
            Jmsg(NULL, M_ERROR, 0,
               _("No Changer Command given for device %s. Cannot continue.\n"),
               device->hdr.name);
            OK = false;
         }
      }
   }
   return OK;
}
/* Init all the autochanger resources found */
Init all the autochanger resources found
Init all the autochanger resources found
bool init_autochangers()
{
   bool OK = true;
   AUTOCHANGER *changer;
   foreach_res(changer, R_AUTOCHANGER) {
      DEVRES *device;
      foreach_alist(device, changer->device) {
         if (!device->changer_name && changer->changer_name) {
            device->changer_name = bstrdup(changer->changer_name);
         }
         if (!device->changer_command && changer->changer_command) {
            device->changer_command = bstrdup(changer->changer_command);
         }
         if (!device->changer_name) {
            Jmsg(NULL, M_ERROR, 0,
               _("No Changer Name given for device %s. Cannot continue.\n"),
               device->hdr.name);
            OK = false;
         }
         if (!device->changer_command) {
            Jmsg(NULL, M_ERROR, 0,
               _("No Changer Command given for device %s. Cannot continue.\n"),
               device->hdr.name);
            OK = false;
         }
      }
   }
   return OK;
}
bool init_autochangers ( ) { bool OK = true ; AUTOCHANGER * changer ; foreach_res ( changer , R_AUTOCHANGER ) { DEVRES * device ; foreach_alist ( device , changer -> device ) { if ( ! device -> changer_name && changer -> changer_name ) { device -> changer_name = bstrdup ( changer -> changer_name ) ; } if ( ! device -> changer_command && changer -> changer_command ) { device -> changer_command = bstrdup ( changer -> changer_command ) ; } if ( ! device -> changer_name ) { Jmsg ( NULL , M_ERROR , 0 , _ ( " \n " ) , device -> hdr . name ) ; OK = false ; } if ( ! device -> changer_command ) { Jmsg ( NULL , M_ERROR , 0 , _ ( " \n " ) , device -> hdr . name ) ; OK = false ; } } } return OK ; }
Init all the autochanger resources found
Init all the autochanger resources found
/* Ensure that the media_type for each device is the same */ /*
          * If the device does not have a changer name or changer command
          *   defined, use the one from the Autochanger resource
          */