Hi.
Since it is impossible to output just "-en" with the current echo, here's a patch for that.


E.g "echo -- -en" gives "-- -en".
With the patch, argument parsing is stopped after encountering a '--',
the above example gives "-en".
echo -
echo ---
echo --en
still work as expected, with output
-
---
--en
respectively.

Use with
patch -p0 echo.c <patch

Maybe noone ever wants to echo -en anyway ;-)

Greets, Arne
--- a/echo.c    Fri Apr  2 17:31:11 2004
+++ b/echo.c    Fri Apr  2 18:30:20 2004
@@ -55,12 +55,12 @@
 
 #if defined (V9_ECHO)
 # if defined (V9_DEFAULT)
-#  define VALID_ECHO_OPTIONS "neE"
+#  define VALID_ECHO_OPTIONS "-neE"
 # else
-#  define VALID_ECHO_OPTIONS "ne"
+#  define VALID_ECHO_OPTIONS "-ne"
 # endif /* !V9_DEFAULT */
 #else /* !V9_ECHO */
-# define VALID_ECHO_OPTIONS "n"
+# define VALID_ECHO_OPTIONS "-n"
 #endif /* !V9_ECHO */
 
 /* The name this program was run with. */
@@ -164,6 +164,16 @@
 #if defined (V9_ECHO)
          else if (allow_options && *temp == 'e')
            do_v9 = 1;
+         /* End option parsing after encountering a --, do not output the --
+          * or, if we have a --, and anything after that, do output that
+          * */
+         else if (allow_options && *temp == '-'){
+                 if (! (*(temp + 1))){
+                               argc--;
+                               argv++;
+                 }
+               goto just_echo;
+      }
 # if defined (V9_DEFAULT)
          else if (allow_options && *temp == 'E')
            do_v9 = 0;
_______________________________________________
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils

Reply via email to