Better usage of usage()

This commit is contained in:
Laurent Rineau 2002-09-08 20:56:53 +00:00
parent 219d7faf23
commit af7184ff6c
1 changed files with 8 additions and 3 deletions

View File

@ -28,13 +28,17 @@ typedef K::Point_2 Point;
Mesh mesh;
void usage(char** argv)
{
std::cerr << "Usage: " << std::endl
<< argv[0] << " input.poly [output.poly]" << std::endl;
}
int main(int argc, char** argv)
{
if(argc<2 || argc> 3)
{
std::cerr << "Usage: " << std::endl
<< argv[0] << " input.poly [output.poly]" <<
std::endl;
usage(argv);
return 1;
};
std::ifstream input(argv[1]);
@ -43,6 +47,7 @@ int main(int argc, char** argv)
else
{
std::cerr << "Bad file: " << argv[1] << std::endl;
usage(argv);
return 1;
}