Commit 2591d585 authored by Michael Ott's avatar Michael Ott
Browse files

Add command line parameter -i to specify starting topic number (default is 0)

parent 2956cfa1
......@@ -73,11 +73,16 @@ int main(int argc, char** argv)
host = "localhost";
}
while ((ret=getopt(argc, argv, "+h:"))!=-1) {
int indexOffset = 0;
while ((ret=getopt(argc, argv, "+h:i:"))!=-1) {
switch(ret) {
case 'h':
host = optarg;
break;
case 'i':
indexOffset = atoi(optarg);
std::cout << "i: " << optarg << std::endl;
break;
default:
usage(argc, argv);
exit(EXIT_FAILURE);
......@@ -104,8 +109,8 @@ int main(int argc, char** argv)
std::string s;
std::vector<std::string> vec;
std::vector<sensor_t> sensors;
std::string csvFilename = argv[1];
std::string prefix = argv[2];
std::string csvFilename = argv[optind];
std::string prefix = argv[optind+1];
uint64_t lineno = 0;
/* Read header line from CSV to obtain sensor names and topics */
......@@ -116,7 +121,7 @@ int main(int argc, char** argv)
std::getline(fs, s);
lineno++;
boost::tokenizer<boost::escaped_list_separator<char> > tk(s, boost::escaped_list_separator<char>('\\', ',', '\"'));
int topics = 0;
int topics = indexOffset;
for (boost::tokenizer<boost::escaped_list_separator<char> >::iterator i=tk.begin(); i!=tk.end();++i)
{
if (i == tk.begin()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment