don't print the whole usage if called wrongly, just tell about it.

This commit is contained in:
git@daemon.de
2014-01-28 13:33:38 +01:00
parent df6cd442fb
commit fa9d8ed800

View File

@@ -23,13 +23,15 @@
#include "pcp.h" #include "pcp.h"
#include "defines.h" #include "defines.h"
void usage() { void usage(int error) {
fprintf(stderr, PCP_HELP_INTRO); fprintf(stderr, PCP_HELP_INTRO);
fprintf(stderr, PCP_HELP); if(error == 0)
fprintf(stderr, PCP_HELP);
version(); version();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
void version() { void version() {
fprintf(stderr, "pcp version %d.%d.%d, use --help to learn how to use.\n", fprintf(stderr, "pcp version %d.%d.%d, use --help to learn how to use.\n",
PCP_VERSION_MAJOR, PCP_VERSION_MINOR, PCP_VERSION_PATCH); PCP_VERSION_MAJOR, PCP_VERSION_MINOR, PCP_VERSION_PATCH);
@@ -224,9 +226,9 @@ int main (int argc, char **argv) {
case 'v': case 'v':
version(); version();
case 'h': case 'h':
usage(); usage(0);
default: default:
usage(); usage(1);
} }
} }