Why to use it only for fist option? I would prefer to add that as option separator (like in attached patch). I had that issue report against Red Hat Enterprise Linux (https://bugzilla.redhat.com/show_bug.cgi?id=431005) and submitted following patch to Fedora Rawhide branch ~1 month ago. Was going to send the patch to that list, but forgot to do that...
Greetings, Ondrej Vasik Adam Rosenwald wrote: > I left out some <very important> curly braces. Here's the working patch: > > === BEGIN PATCH === > > --- echo.c.orig 2008-03-13 01:59:22.000000000 -0400 > +++ echo.c 2008-03-13 01:59:37.000000000 -0400 > @@ -145,6 +145,7 @@ > parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION, > usage, AUTHORS, (char const *) NULL); > > + char first=1; > --argc; > ++argv; > > @@ -154,6 +155,15 @@ > char const *temp = argv[0] + 1; > size_t i; > > + if (first == 1) { > + first = 0; > + if (temp[0] == '-') { > + --argc; > + ++argv; > + goto just_echo; > + } > + } > + > /* If it appears that we are handling options, then make sure that > all of the options specified are actually valid. Otherwise, the > string should just be echoed. */ > > === END PATCH === > > Adam Rosenwald wrote: > > Try using echo to output the string '-e' or '-E' or '-n' literally. > > You can't. Furthermore try executing `echo -e [-eEn]...`. Nothing > > but a blank line. > > > > The patch below utilizes a familiar technique (used, e.g., in grep) to > > escape arguments; however, admittedly it can be rendered more elegant. :) > > > > This was patched against the 03/12/08 coreutils GIT version; however, > > echo.c doesn't appear to have changed substantively for years. > > > > === BEGIN PATCH === > > > > --- echo.c.orig 2008-03-13 01:33:08.000000000 -0400 > > +++ echo.c 2008-03-13 01:35:04.000000000 -0400 > > @@ -145,6 +145,7 @@ > > parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION, > > usage, AUTHORS, (char const *) NULL); > > > > + char first=1; > > --argc; > > ++argv; > > > > @@ -154,6 +155,14 @@ > > char const *temp = argv[0] + 1; > > size_t i; > > > > + if (first == 1) { > > + first = 0; > > + if (temp[0] == '-') > > + --argc; > > + ++argv; > > + goto just_echo; > > + } > > + > > /* If it appears that we are handling options, then make sure that > > all of the options specified are actually valid. Otherwise, the > > string should just be echoed. */ > > > > === END PATCH === > > > > > > Regards, > > > > - A. > > > > > > _______________________________________________ > Bug-coreutils mailing list > Bug-coreutils@gnu.org > http://lists.gnu.org/mailman/listinfo/bug-coreutils
patch
Description: application/mbox
signature.asc
Description: Toto je digitálně podepsaná část zprávy
_______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils