From 0b2c90d5ff8414b09df710b93c039ad4d5973f43 Mon Sep 17 00:00:00 2001 From: Hippolyte Chauvin Date: Mon, 4 Dec 2023 22:52:58 +0100 Subject: [PATCH] first-free-port : meilleurs messages d'erreur --- src/first-free-port.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/first-free-port.c b/src/first-free-port.c index c823684..1e246cd 100644 --- a/src/first-free-port.c +++ b/src/first-free-port.c @@ -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; } }