X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Fapplications%2Futilities%2Fsplitter.cpp;h=a6f90526a20d3ba762a37bdee1df33e098e1d3ce;hb=81051c046fd76bf2c11641b4d3f64c85261d7d22;hp=0de8347ae5623fa1e4ef96affd25d58afa9e65d5;hpb=3ea085ec301ed1399dfa1e9f3a240312dc95410b;p=feisty_meow.git diff --git a/nucleus/applications/utilities/splitter.cpp b/nucleus/applications/utilities/splitter.cpp index 0de8347a..a6f90526 100644 --- a/nucleus/applications/utilities/splitter.cpp +++ b/nucleus/applications/utilities/splitter.cpp @@ -65,7 +65,7 @@ Any filenames on the command line are split and sent to standard output.\n\ The following options change how the splitting is performed:\n\ --help or -?\tShow this help information.\n\ --mincol N\tMinimum column to use for output.\n\ - --maxcol N\tMinimum column to use for output.\n\ + --maxcol N\tMaximum column to use for output.\n\ ")); return -3; } @@ -77,11 +77,19 @@ int splitter_app::execute() // retrieve any specific flags first. astring temp; int min_col = 0; - if (cmds.get_value("mincol", temp)) + int min_indy = -1; +//hmmm: this whole thing is annoying. we need a better way to have a list of parms. + if (cmds.find("mincol", min_indy)) { + cmds.get_value("mincol", temp); min_col = temp.convert(min_col); - int max_col = 77; - if (cmds.get_value("maxcol", temp)) + } + int max_col = 78; + int max_indy = -1; + if (cmds.find("maxcol", max_indy)) { + cmds.get_value("maxcol", temp); max_col = temp.convert(max_col); + } +//printf("got max_col=%d\n", max_col); // look for help command. int junk_index = 0; if (cmds.find("help", junk_index, false) @@ -92,9 +100,18 @@ int splitter_app::execute() return 0; } + // see if we found any flags that would make us skip some of the parameters. +//hmmm: automate this! + int skip_index = 0; + if ( (min_indy >= 0) || (max_indy >= 0) ) { + skip_index = basis::maximum(min_indy, max_indy); + skip_index += 2; + } +//printf("got a skip index of %d\n", skip_index); + // gather extra input files. string_set input_files; - for (int i = 0; i < cmds.entries(); i++) { + for (int i = skip_index; i < cmds.entries(); i++) { const command_parameter &curr = cmds.get(i); if (curr.type() == command_parameter::VALUE) { //log(astring("adding input file:") + curr.text()); @@ -112,7 +129,6 @@ int splitter_app::execute() if (!num_chars) continue; //printf("line len=%d, cont=%s\n", line_read.length(), line_read.s()); accumulator += line_read; -//// accumulator += '\n'; } } @@ -124,7 +140,6 @@ int splitter_app::execute() if (!got) break; //printf("line=%s\n", got); accumulator += got; -//// accumulator += '\n'; } } //printf("splitting accum with %d chars...\n", accumulator.length());