tool/CommandFoeWrite.cpp
changeset 1869 14f634f5b613
parent 1826 ec6223c3b7ec
child 1870 0cee1fb7f0fd
equal deleted inserted replaced
1868:489ea0becd74 1869:14f634f5b613
    80 
    80 
    81 /****************************************************************************/
    81 /****************************************************************************/
    82 
    82 
    83 void CommandFoeWrite::execute(const StringVector &args)
    83 void CommandFoeWrite::execute(const StringVector &args)
    84 {
    84 {
       
    85 	MasterIndexList masterIndices;
    85     stringstream err;
    86     stringstream err;
    86     ec_ioctl_slave_foe_t data;
    87     ec_ioctl_slave_foe_t data;
    87     ifstream file;
    88     ifstream file;
    88     SlaveList slaves;
    89     SlaveList slaves;
    89     string storeFileName;
    90     string storeFileName;
    91     if (args.size() != 1) {
    92     if (args.size() != 1) {
    92         err << "'" << getName() << "' takes exactly one argument!";
    93         err << "'" << getName() << "' takes exactly one argument!";
    93         throwInvalidUsageException(err);
    94         throwInvalidUsageException(err);
    94     }
    95     }
    95 
    96 
    96     if (getMasterIndices().size() != 1) {
    97 	masterIndices = getMasterIndices();
       
    98     if (masterIndices.size() != 1) {
    97         err << getName() << " requires to select a single master!";
    99         err << getName() << " requires to select a single master!";
    98         throwInvalidUsageException(err);
   100         throwInvalidUsageException(err);
    99     }
   101     }
   100     MasterDevice m(getMasterIndices().front());
   102     MasterDevice m(masterIndices.front());
   101 
   103 
   102     if (args[0] == "-") {
   104     if (args[0] == "-") {
   103         loadFoeData(&data, cin);
   105         loadFoeData(&data, cin);
   104         if (getOutputFile().empty()) {
   106         if (getOutputFile().empty()) {
   105             err << "Please specify a filename for the slave side"
   107             err << "Please specify a filename for the slave side"