diff options
Diffstat (limited to 'src/echo.c')
-rw-r--r-- | src/echo.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/echo.c b/src/echo.c index ddf3b1783..2e27abe63 100644 --- a/src/echo.c +++ b/src/echo.c @@ -57,6 +57,19 @@ on System V systems with the -E option. # define VALID_ECHO_OPTIONS "n" #endif /* !V9_ECHO */ +/* The name this program was run with. */ +char *program_name; + +void parse_long_options (); + +static void +usage () +{ + fprintf (stderr, "Usage: %s [{--help,--version}] [-ne] [string ...]\n", + program_name); + exit (1); +} + /* Print the words in LIST to standard output. If the first word is `-n', then don't print a trailing newline. We also support the echo syntax from Version 9 unix systems. */ @@ -67,6 +80,10 @@ main (argc, argv) { int display_return = 1, do_v9 = 0; + program_name = argv[0]; + + parse_long_options (argc, argv, usage); + /* System V machines already have a /bin/sh with a v9 behaviour. We use the identical behaviour for these machines so that the existing system shell scripts won't barf. */ |