33 using namespace basis;
48 virtual int execute();
61 log(astring::empty_string());
63 This program splits long lines in input files into a more reasonable size.\n\
64 Any filenames on the command line are split and sent to standard output.\n\
65 The following options change how the splitting is performed:\n\
66 --help or -?\tShow this help information.\n\
67 --mincol N\tMinimum column to use for output.\n\
68 --maxcol N\tMaximum column to use for output.\n\
73 int splitter_app::execute()
82 if (cmds.find(
"mincol", min_indy)) {
83 cmds.get_value(
"mincol", temp);
84 min_col = temp.
convert(min_col);
88 if (cmds.find(
"maxcol", max_indy)) {
89 cmds.get_value(
"maxcol", temp);
90 max_col = temp.
convert(max_col);
95 if (cmds.find(
"help", junk_index,
false)
96 || cmds.find(
'h', junk_index,
false)
97 || cmds.find(
"?", junk_index,
false)
98 || cmds.find(
'?', junk_index,
false) ) {
106 if ( (min_indy >= 0) || (max_indy >= 0) ) {
114 for (
int i = skip_index; i < cmds.entries(); i++) {
118 input_files += curr.
text();
123 for (
int q = 0; q < input_files.
length(); q++) {
125 if (!current.good())
continue;
126 while (!current.eof()) {
128 int num_chars = current.getline(line_read,
MAX_BUFFER);
129 if (!num_chars)
continue;
131 accumulator += line_read;
136 if (!input_files.
length()) {
138 while (!feof(stdin)) {
139 char *got = fgets(input_line,
MAX_BUFFER, stdin);
149 printf(
"%s", chewed.
s());
int print_instructions(bool good, const astring &program_name)
The application_shell is a base object for console programs.
const basis::astring & text() const
observes the string contents.
parameter_types type() const
observes the type of the parameter.
a_sprintf is a specialization of astring that provides printf style support.
int length() const
Returns the current reported length of the allocated C array.
Provides a dynamically resizable ASCII character string.
const char * s() const
synonym for observe. the 's' stands for "string", if that helps.
int convert(int default_value) const
Converts the string into a corresponding integer.
Provides file managment services using the standard I/O support.
Provides operations commonly needed on file names.
const basis::astring & raw() const
returns the astring that we're holding onto for the path.
filename basename() const
returns the base of the filename; no directory.
A simple object that wraps a templated set of strings.
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
Provides macros that implement the 'main' program of an application.
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
type maximum(type a, type b)
minimum returns the lesser of two values.
A platform independent way to obtain the timestamp of a file.
A logger that sends to the console screen using the standard output device.
None split_lines(str unsplit_line)
A dynamic container class that holds any kind of object via pointers.