summaryrefslogtreecommitdiff
path: root/src/echo.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-12 01:52:24 +0000
committerJim Meyering <jim@meyering.net>1993-10-12 01:52:24 +0000
commit87fa23e6417d7d1938b72e872d779ae7225a5aa4 (patch)
tree0fcc68f9cdf7315d09d5836df0f261e3d6b8c13a /src/echo.c
parentf12b53b2ce8f0bb0dd28a290f9b27490ef4599a9 (diff)
downloadcoreutils-87fa23e6417d7d1938b72e872d779ae7225a5aa4.tar.xz
merge with 1.8.1b
Diffstat (limited to 'src/echo.c')
-rw-r--r--src/echo.c17
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. */