/* This file is part of Lcrzo.
*/

#ifdef LCRZODEF_SYSTEM_Unix
  /* this function is not needed*/

#elif defined LCRZODEF_SYSTEM_Windows

/*-------------------------------------------------------------*/
int lcrzo_priv_conf_device_init_devicealias(lcrzo_device devicein,
                                            lcrzo_int32 addressnumber,
                                            lcrzo_device deviceout);
int lcrzo_priv_conf_device_init_devicealias(lcrzo_device devicein,
                                            lcrzo_int32 addressnumber,
                                            lcrzo_device deviceout)
{ lcrzo_priv_globalvars *ptrglo;
  lcrzo_device device;
  int ret;

  lcrzo_er(lcrzo_priv_globalvars_ptr_get(&ptrglo));
  switch(ptrglo->windows_systemversion)
  { case LCRZO_WINDOWS_SYSTEMVERSION_nt4:
    case LCRZO_WINDOWS_SYSTEMVERSION_2k:
    case LCRZO_WINDOWS_SYSTEMVERSION_xp:
    case LCRZO_WINDOWS_SYSTEMVERSION_net:
      ret=lcrzo_string_init_text("\\Device\\Packet_", LCRZO_DEVICE_MAXBYTES, device);
      if (ret==LCRZO_ERR_OK)
      { ret=lcrzo_string_append_text(devicein, LCRZO_DEVICE_MAXBYTES, device);
        if ( ret==LCRZO_ERR_OK && addressnumber>1 )
        { ret=lcrzo_string_append_text(":", LCRZO_DEVICE_MAXBYTES, device);
          if ( ret==LCRZO_ERR_OK )
          { ret=lcrzo_string_append_int(addressnumber-1, "%d", LCRZO_DEVICE_MAXBYTES, device);
          }
        }
      }
      break;

    default:
      ret=lcrzo_string_init_text(devicein, LCRZO_DEVICE_MAXBYTES, device);
      if ( ret==LCRZO_ERR_OK && addressnumber>1 )
      { ret=lcrzo_string_append_text(":", LCRZO_DEVICE_MAXBYTES, device);
        if ( ret==LCRZO_ERR_OK )
        { ret=lcrzo_string_append_int(addressnumber-1, "%d", LCRZO_DEVICE_MAXBYTES, device);
        }
      }
      break;
  }

  if (ret!=LCRZO_ERR_OK)
  { ret=lcrzo_device_init(devicein, device);
  }

  ret=lcrzo_priv_device_init_ascii(device, deviceout);
          
  return(ret);
}




#else
 #error "Unknown value for LCRZODEF_SYSTEM"
#endif
