mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 03:50:57 +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 "defines.h"
|
||||
|
||||
void usage() {
|
||||
void usage(int error) {
|
||||
fprintf(stderr, PCP_HELP_INTRO);
|
||||
fprintf(stderr, PCP_HELP);
|
||||
if(error == 0)
|
||||
fprintf(stderr, PCP_HELP);
|
||||
version();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
void version() {
|
||||
fprintf(stderr, "pcp version %d.%d.%d, use --help to learn how to use.\n",
|
||||
PCP_VERSION_MAJOR, PCP_VERSION_MINOR, PCP_VERSION_PATCH);
|
||||
@@ -224,9 +226,9 @@ int main (int argc, char **argv) {
|
||||
case 'v':
|
||||
version();
|
||||
case 'h':
|
||||
usage();
|
||||
usage(0);
|
||||
default:
|
||||
usage();
|
||||
usage(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user