View | Details | Raw Unified | Return to bug 81
Collapse All | Expand All

(-)a/samples/main-default-value.cc (-1 / +1 lines)
 Lines 62-68   int main (int argc, char* argv[]) Link Here 
62
  //utilize the loops variable to show that it can be read from the command line
62
  //utilize the loops variable to show that it can be read from the command line
63
  if(loops>0)
63
  if(loops>0)
64
  {
64
  {
65
    cout<<"You requested "<<loops<<" iterations of a loop";
65
    std::cerr<<"You requested "<<loops<<" iterations of a loop";
66
    for(uint32_t i=0;i<loops;++i)
66
    for(uint32_t i=0;i<loops;++i)
67
      cout<<"iteration "<<i;
67
      cout<<"iteration "<<i;
68
  }
68
  }
(-)a/src/core/command-line.cc (-1 / +9 lines)
 Lines 20-25    Link Here 
20
 */
20
 */
21
21
22
#include "command-line.h"
22
#include "command-line.h"
23
#include "ns3/debug.h"
23
#include <unistd.h>
24
#include <unistd.h>
24
25
25
namespace ns3 {
26
namespace ns3 {
 Lines 109-116   CommandLine::Parse (int argc, char *argv Link Here 
109
      std::string name, value;
110
      std::string name, value;
110
      if (cur == std::string::npos)
111
      if (cur == std::string::npos)
111
        {
112
        {
113
          if (argc == 1)
114
            {
115
              // invalid argument. ignore it.
116
              continue;
117
            }
118
          argv++;
119
          argc--;
112
          name = param;
120
          name = param;
113
          value = "";
121
          value = *argv;
114
        }
122
        }
115
      else
123
      else
116
        {
124
        {
(-)a/src/core/command-line.h (-2 / +12 lines)
 Lines 24-29    Link Here 
24
#include <list>
24
#include <list>
25
#include <string>
25
#include <string>
26
#include "default-value.h"
26
#include "default-value.h"
27
#include <iostream>
27
28
28
namespace ns3 {
29
namespace ns3 {
29
30
 Lines 123-130   CommandLine::UserDefaultValue<T>::DoPars Link Here 
123
  iss.str (value);
124
  iss.str (value);
124
  T v;
125
  T v;
125
  iss >> v;
126
  iss >> v;
126
  *m_valuePtr = v;
127
  bool ok = (!iss.bad () && !iss.fail ());
127
  return !iss.bad () && !iss.fail ();
128
  if (ok)
129
    {
130
      *m_valuePtr = v;
131
    }
132
  else
133
    {
134
      std::cerr << "Warning: failed to parse user argument of type "
135
                << typeid (T).name () << " and value " << value << std::endl;
136
    }
137
  return ok;
128
}
138
}
129
template <typename T>
139
template <typename T>
130
std::string
140
std::string

Return to bug 81