diff options
Diffstat (limited to 'src/echo.c')
-rw-r--r-- | src/echo.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/echo.c b/src/echo.c index c4b7ca939..91cce86d6 100644 --- a/src/echo.c +++ b/src/echo.c @@ -124,9 +124,20 @@ main (int argc, char **argv) atexit (close_stdout); - if (allow_options) - parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version, - usage, AUTHORS, (char const *) NULL); + /* We directly parse options, rather than use parse_long_options, in + order to avoid accepting abbreviations. */ + if (allow_options && argc == 2) + { + if (STREQ (argv[1], "--help")) + usage (EXIT_SUCCESS); + + if (STREQ (argv[1], "--version")) + { + version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS, + (char *) NULL); + exit (EXIT_SUCCESS); + } + } --argc; ++argv; |