tool/CommandAlias.cpp
changeset 1870 0cee1fb7f0fd
parent 1869 14f634f5b613
child 1968 4f682084c643
equal deleted inserted replaced
1869:14f634f5b613 1870:0cee1fb7f0fd
    79 void CommandAlias::execute(const StringVector &args)
    79 void CommandAlias::execute(const StringVector &args)
    80 {
    80 {
    81     uint16_t alias;
    81     uint16_t alias;
    82     stringstream err, strAlias;
    82     stringstream err, strAlias;
    83     int number;
    83     int number;
    84 	MasterIndexList masterIndices;
       
    85     SlaveList slaves;
    84     SlaveList slaves;
    86     SlaveList::const_iterator si;
    85     SlaveList::const_iterator si;
    87 
    86 
    88     if (args.size() != 1) {
    87     if (args.size() != 1) {
    89         err << "'" << getName() << "' takes exactly one argument!";
    88         err << "'" << getName() << "' takes exactly one argument!";
    98         err << "Invalid alias '" << args[0] << "'!";
    97         err << "Invalid alias '" << args[0] << "'!";
    99         throwInvalidUsageException(err);
    98         throwInvalidUsageException(err);
   100     }
    99     }
   101     alias = number;
   100     alias = number;
   102 
   101 
   103 	masterIndices = getMasterIndices();
   102     MasterDevice m(getSingleMasterIndex());
   104     if (masterIndices.size() != 1) {
       
   105         err << getName() << " requires to select a single master!";
       
   106         throwInvalidUsageException(err);
       
   107     }
       
   108     MasterDevice m(masterIndices.front());
       
   109     m.open(MasterDevice::ReadWrite);
   103     m.open(MasterDevice::ReadWrite);
   110     slaves = selectedSlaves(m);
   104     slaves = selectedSlaves(m);
   111     
   105     
   112     if (slaves.size() > 1 && !getForce()) {
   106     if (slaves.size() > 1 && !getForce()) {
   113         err << "This will write the alias addresses of "
   107         err << "This will write the alias addresses of "