76 |
76 |
77 /****************************************************************************/ |
77 /****************************************************************************/ |
78 |
78 |
79 void CommandSiiWrite::execute(const StringVector &args) |
79 void CommandSiiWrite::execute(const StringVector &args) |
80 { |
80 { |
|
81 MasterIndexList masterIndices; |
81 stringstream err; |
82 stringstream err; |
82 ec_ioctl_slave_sii_t data; |
83 ec_ioctl_slave_sii_t data; |
83 ifstream file; |
84 ifstream file; |
84 SlaveList slaves; |
85 SlaveList slaves; |
85 |
86 |
86 if (args.size() != 1) { |
87 if (args.size() != 1) { |
87 err << "'" << getName() << "' takes exactly one argument!"; |
88 err << "'" << getName() << "' takes exactly one argument!"; |
88 throwInvalidUsageException(err); |
89 throwInvalidUsageException(err); |
89 } |
90 } |
90 |
91 |
91 if (getMasterIndices().size() != 1) { |
92 masterIndices = getMasterIndices(); |
|
93 if (masterIndices.size() != 1) { |
92 err << getName() << " requires to select a single master!"; |
94 err << getName() << " requires to select a single master!"; |
93 throwInvalidUsageException(err); |
95 throwInvalidUsageException(err); |
94 } |
96 } |
95 MasterDevice m(getMasterIndices().front()); |
97 MasterDevice m(masterIndices.front()); |
96 |
98 |
97 if (args[0] == "-") { |
99 if (args[0] == "-") { |
98 loadSiiData(&data, cin); |
100 loadSiiData(&data, cin); |
99 } else { |
101 } else { |
100 file.open(args[0].c_str(), ifstream::in | ifstream::binary); |
102 file.open(args[0].c_str(), ifstream::in | ifstream::binary); |