Skip to content

Commit

Permalink
* Add parameters to printHelpMessage, parseArguments to permit printi…
Browse files Browse the repository at this point in the history
…ng a string to describe the free arguments

* Add appropriate strings to equal and row-echelon-form
  • Loading branch information
hovinen committed Jun 22, 2011
1 parent 3aec33b commit b08dad9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion util/equal.C
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ int main (int argc, char **argv)
{ '\0' }
};

parseArguments (argc, argv, args, 2, &input1, &input2);
parseArguments (argc, argv, args, "<first matrix filename> <second matrix filename>", 2, &input1, &input2);

commentator.setBriefReportParameters (Commentator::OUTPUT_CONSOLE, false, false, false);
commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
Expand Down
2 changes: 1 addition & 1 deletion util/row-echelon-form.C
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ int main (int argc, char **argv)
{ '\0' }
};

parseArguments (argc, argv, args, 2, &input, &output);
parseArguments (argc, argv, args, "<input-filename> <output-filename>", 2, &input, &output);

commentator.setBriefReportParameters (Commentator::OUTPUT_CONSOLE, false, false, false);
commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
Expand Down
8 changes: 4 additions & 4 deletions util/support.C
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ template <> MatrixType get_matrix_type<Modular<double> > (const char *str);

/* Display a help message on command usage */

void printHelpMessage (const char *program, Argument *args, bool printDefaults)
void printHelpMessage (const char *program, Argument *args, const char *freeArgsText, bool printDefaults)
{
int i, l;

// Skip past libtool prefix in program name
if (!strncmp (program, "lt-", strlen ("lt-")))
program += strlen ("lt-");

std::cout << "Usage: " << program << " [options] [<report file>]" << std::endl;
std::cout << "Usage: " << program << " [options] " << freeArgsText << " [<report file>]" << std::endl;
std::cout << std::endl;
std::cout << "Where [options] are the following:" << std::endl;

Expand Down Expand Up @@ -110,7 +110,7 @@ Argument *findArgument (Argument *args, char c)
return (Argument *) 0;
}

void parseArguments (int argc, char **argv, Argument *args, int freeArgs, ...)
void parseArguments (int argc, char **argv, Argument *args, const char *freeArgsText, int freeArgs, ...)
{
int i;
Argument *current;
Expand All @@ -127,7 +127,7 @@ void parseArguments (int argc, char **argv, Argument *args, int freeArgs, ...)
std::cout.flush ();
}
else if (argv[i][1] == 'h' || argv[i][1] == '?') {
printHelpMessage (argv[0], args, true);
printHelpMessage (argv[0], args, freeArgsText, true);
exit (1);
}
else if ((current = findArgument (args, argv[i][1])) != (Argument *) 0) {
Expand Down
4 changes: 2 additions & 2 deletions util/support.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ MatrixType get_matrix_type<LinBox::GF2> (const char *str)
/* template <class Ring> */
/* MatrixType get_matrix_type (const char *str); */

void parseArguments (int argc, char **argv, Argument *args, int freeArgs, ...);
void printHelpMessage (const char *program, Argument *args, bool printDefaults = false);
void parseArguments (int argc, char **argv, Argument *args, const char *freeArgsText, int freeArgs, ...);
void printHelpMessage (const char *program, Argument *args, const char *freeArgsText, bool printDefaults = false);

#endif // __LINBOX_UTIL_SUPPORT_H

Expand Down

0 comments on commit b08dad9

Please sign in to comment.