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;
}
// retrieve any specific flags first.
astring temp;
int min_col = 0;
- if (cmds.get_value("mincol", temp))
+ int min_indy = 0;
+//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 = 0;
+ 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)
return 0;
}
+ int 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());
+log(astring("adding input file:") + curr.text());
input_files += curr.text();
}
}
if (!num_chars) continue;
//printf("line len=%d, cont=%s\n", line_read.length(), line_read.s());
accumulator += line_read;
-//// accumulator += '\n';
}
}
if (!got) break;
//printf("line=%s\n", got);
accumulator += got;
-//// accumulator += '\n';
}
}
//printf("splitting accum with %d chars...\n", accumulator.length());
#include <textual/parser_bits.h>
#include <loggers/program_wide_logger.h>
+#include <stdio.h>
+//temp
+
#undef LOG
#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s)
bool command_line::get_value(char option_character, astring &value,
bool case_sense) const
{
+ FUNCDEF("get_value");
value = "";
int posn = 0; // where we find the flag.
if (!find(option_character, posn, case_sense)) return false;
value = "";
int posn = 0; // where we find the flag.
if (!find(option_string, posn, case_sense)) return false;
+//printf("found the flag! at %d\n", posn);
// get the value after the flag, if there is such.
posn++; // this is where we think our flag's value lives.
if (posn >= entries()) return false;
+//printf("next posn is still okay at %d\n", posn);
// there's still an entry after where we found our flag; grab it.
command_parameter cp = get(posn);
+//printf("comm parm has text %s\n", cp.text().s());
if (cp.type() != command_parameter::VALUE) return false;
// finally; we've found an appropriate text value.
value = cp.text();
+//printf("assigning value %s\n", value.s());
return true;
}
// check that we're still in bounds.
int chars_added = next_break - j + 1;
- if (col + chars_added + punct_adder > max_column + 1) {
+ if (col + chars_added + punct_adder > max_column) {
// we need to break before the next breakable character.
break_line = true;
just_had_break = true;
- if (col + chars_added <= max_column + 1) {
+ if (col + chars_added <= max_column) {
// it will fit without the punctuation spaces, which is fine since
// it should be the end of the line.
invisible = false;
end_sentence = false;
punct_adder = 0;
keep_on_line = true;
- } else if (min_column + chars_added > max_column + 1) {
+ } else if (min_column + chars_added > max_column) {
// this word won't ever fit unless we break it.
int chars_left = max_column - col + 1;
// remember to take out room for the dash also.
# decide whether they've got splitter available or not.
if [ -f "$BINDIR/splitter" -o -f "$BINDIR/splitter.exe" ]; then
- splitter="$BINDIR/splitter"
+ splitter="$BINDIR/splitter --maxcol $(($COLUMNS - 1))"
else
# not available, so just emit as huge overly long string.
splitter="cat"