mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 12:00:56 +01:00
don't print the whole usage if called wrongly, just tell about it.
This commit is contained in:
10
src/pcp.c
10
src/pcp.c
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user