projects
/
feisty_meow.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4c8e217
)
fixing column flags for splitter. also need to fix some persistent issues with end...
author
Chris Koeritz
<fred@gruntose.com>
Sun, 22 Nov 2015 09:40:06 +0000
(
04:40
-0500)
committer
Chris Koeritz
<fred@gruntose.com>
Sun, 22 Nov 2015 09:40:06 +0000
(
04:40
-0500)
nucleus/applications/utilities/splitter.cpp
patch
|
blob
|
history
nucleus/library/application/command_line.cpp
patch
|
blob
|
history
nucleus/library/textual/string_manipulation.cpp
patch
|
blob
|
history
scripts/core/inventory.sh
patch
|
blob
|
history
diff --git
a/nucleus/applications/utilities/splitter.cpp
b/nucleus/applications/utilities/splitter.cpp
index 0de8347ae5623fa1e4ef96affd25d58afa9e65d5..7eac606f676b90931fb354bd92bb3f74f82ab996 100644
(file)
--- 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\
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\tM
in
imum column to use for output.\n\
+ --maxcol N\tM
ax
imum column to use for output.\n\
"));
return -3;
}
"));
return -3;
}
@@
-77,11
+77,19
@@
int splitter_app::execute()
// retrieve any specific flags first.
astring temp;
int min_col = 0;
// 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);
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);
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)
// look for help command.
int junk_index = 0;
if (cmds.find("help", junk_index, false)
@@
-92,12
+100,16
@@
int splitter_app::execute()
return 0;
}
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;
// 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) {
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();
}
}
input_files += curr.text();
}
}
@@
-112,7
+124,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;
if (!num_chars) continue;
//printf("line len=%d, cont=%s\n", line_read.length(), line_read.s());
accumulator += line_read;
-//// accumulator += '\n';
}
}
}
}
@@
-124,7
+135,6
@@
int splitter_app::execute()
if (!got) break;
//printf("line=%s\n", got);
accumulator += got;
if (!got) break;
//printf("line=%s\n", got);
accumulator += got;
-//// accumulator += '\n';
}
}
//printf("splitting accum with %d chars...\n", accumulator.length());
}
}
//printf("splitting accum with %d chars...\n", accumulator.length());
diff --git
a/nucleus/library/application/command_line.cpp
b/nucleus/library/application/command_line.cpp
index 0fb818aa90b3fb8045b19cc75538ea8f68ac32b7..de6d611092a0a53c1397920f8e5cbf48e794b1ef 100644
(file)
--- a/
nucleus/library/application/command_line.cpp
+++ b/
nucleus/library/application/command_line.cpp
@@
-25,6
+25,9
@@
#include <textual/parser_bits.h>
#include <loggers/program_wide_logger.h>
#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)
#undef LOG
#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s)
@@
-367,6
+370,7
@@
LOG(astring("found option string with dash! string is: ") + option_string);
bool command_line::get_value(char option_character, astring &value,
bool case_sense) const
{
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_character, posn, case_sense)) return false;
@@
-394,17
+398,21
@@
LOG(astring("found option string with dash! string is: ") + option_string);
value = "";
int posn = 0; // where we find the flag.
if (!find(option_string, 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;
// 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);
// 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();
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;
}
return true;
}
diff --git
a/nucleus/library/textual/string_manipulation.cpp
b/nucleus/library/textual/string_manipulation.cpp
index a0febcaa3a9c4eb3dd32b4d75b5efdfc5bbf8d17..b2ba47480437849ce92d8dc23be30788e3c6a955 100644
(file)
--- a/
nucleus/library/textual/string_manipulation.cpp
+++ b/
nucleus/library/textual/string_manipulation.cpp
@@
-222,11
+222,11
@@
void string_manipulation::split_lines(const astring &input_in, astring &output,
// check that we're still in bounds.
int chars_added = next_break - j + 1;
// 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;
// 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;
// it will fit without the punctuation spaces, which is fine since
// it should be the end of the line.
invisible = false;
@@
-234,7
+234,7
@@
void string_manipulation::split_lines(const astring &input_in, astring &output,
end_sentence = false;
punct_adder = 0;
keep_on_line = true;
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.
// 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.
diff --git
a/scripts/core/inventory.sh
b/scripts/core/inventory.sh
index 4e88af11f526ff36ae551d1676c2845c2cc751f2..d4a00e5c0ed7999e1bcb9f738a307979dee15c6f 100644
(file)
--- a/
scripts/core/inventory.sh
+++ b/
scripts/core/inventory.sh
@@
-37,7
+37,7
@@
fi
# decide whether they've got splitter available or not.
if [ -f "$BINDIR/splitter" -o -f "$BINDIR/splitter.exe" ]; then
# 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"
else
# not available, so just emit as huge overly long string.
splitter="cat"