From 5c022b0f411e6cd7c35f2905b77fe2a1df2cd760 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 11 Feb 2023 16:42:43 -0800 Subject: Print which arguments were unknown before giving usage message Signed-off-by: Alan Coopersmith --- xmore.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xmore.c b/xmore.c index ed6be29..4ff53f4 100644 --- a/xmore.c +++ b/xmore.c @@ -146,6 +146,11 @@ int main( int argc, char *argv[] ) if (argc != 2) { + fputs("Unknown argument(s):", stderr); + for (int i = 1; i < argc; i++) { + fprintf(stderr, " %s", argv[i]); + } + fputs("\n\n", stderr); printf("usage: %s [ x options ] filename\n", argv[0]); exit(EXIT_FAILURE); } -- cgit v1.2.3