first-free-port : meilleurs messages d'erreur

This commit is contained in:
Hippolyte Chauvin 2023-12-04 22:52:58 +01:00
parent 581fcd3f0a
commit 0b2c90d5ff

View file

@ -81,14 +81,14 @@ int main(int argc, char *argv[]) {
}
if (!is_valid_tcp_port(current_port)) {
fprintf(stderr, "Provide a valid TCP port number as first argument.\n");
fprintf(stderr, "%s: provide a valid TCP port number as first argument.\n", argv[0]);
return EX_USAGE;
}
// Open TCP table
FILE *tcp_table_fptr = fopen(TCP_TABLE, "r");
if (tcp_table_fptr == NULL) {
fprintf(stderr, "Error opening the TCP table.\n");
fprintf(stderr, "%s: error opening the TCP table.\n", argv[0]);
return EX_OSFILE;
}
@ -106,7 +106,7 @@ int main(int argc, char *argv[]) {
printf("%d\n", current_port);
return EXIT_SUCCESS;
} else {
fprintf(stderr, "No more ports available. How did you fuck up that bad ???\n");
fprintf(stderr, "%s: no more ports available; how did you fuck up that bad ???\n", argv[0]);
return EX_TEMPFAIL;
}
}