equal
deleted
inserted
replaced
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; |
84 SlaveList slaves; |
85 SlaveList slaves; |
85 SlaveList::const_iterator si; |
86 SlaveList::const_iterator si; |
86 |
87 |
87 if (args.size() != 1) { |
88 if (args.size() != 1) { |
88 err << "'" << getName() << "' takes exactly one argument!"; |
89 err << "'" << getName() << "' takes exactly one argument!"; |
97 err << "Invalid alias '" << args[0] << "'!"; |
98 err << "Invalid alias '" << args[0] << "'!"; |
98 throwInvalidUsageException(err); |
99 throwInvalidUsageException(err); |
99 } |
100 } |
100 alias = number; |
101 alias = number; |
101 |
102 |
102 if (getMasterIndices().size() != 1) { |
103 masterIndices = getMasterIndices(); |
|
104 if (masterIndices.size() != 1) { |
103 err << getName() << " requires to select a single master!"; |
105 err << getName() << " requires to select a single master!"; |
104 throwInvalidUsageException(err); |
106 throwInvalidUsageException(err); |
105 } |
107 } |
106 MasterDevice m(getMasterIndices().front()); |
108 MasterDevice m(masterIndices.front()); |
107 m.open(MasterDevice::ReadWrite); |
109 m.open(MasterDevice::ReadWrite); |
108 slaves = selectedSlaves(m); |
110 slaves = selectedSlaves(m); |
109 |
111 |
110 if (slaves.size() > 1 && !getForce()) { |
112 if (slaves.size() > 1 && !getForce()) { |
111 err << "This will write the alias addresses of " |
113 err << "This will write the alias addresses of " |