John Colvin, el 7 de July a las 22:39 me escribiste: > On Sunday, 7 July 2013 at 20:08:19 UTC, Leandro Lucarella wrote: > >Andrei Alexandrescu, el 7 de July a las 09:06 me escribiste: > >>On 7/7/13 8:55 AM, Andrei Alexandrescu wrote: > >>>Here's a conformant implementation for reference: > >>>http://www.scs.stanford.edu/histar/src/pkg/echo/echo.c > >> > >>Hmm, that's actually not so good, it doesn't ensure that I/O was > >>successful. Anyhow, here's a possibility: > >> > >>import std.stdout; > >>void main(string[] args) > >>{ > >> const appendNewline = args.length > 1 && args[1] == "-n"; > >> foreach (i, arg; args[appendNewline + 1 .. $]) > >> { > >> if (i) write(' '); > >> write(arg); > >> } > >> if (nl) writeln(); > >>} > >> > >>But then I figured echo must do escape character processing, see > >>e.g. http://www.raspberryginger.com/jbailey/minix/html/echo_8c-source.html. > >>With that the blog entry would become quite interesting. > > > >If you want the specification, here it is :) > >http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html > > I prefer this one :p http://www.gnu.org/fun/jokes/echo-msg.html > > From the opengroup spec: > "If the first operand is -n, or if any of the operands contain a > <backslash> character, the results are implementation-defined." > > Ah...specifications... > > > I'm gonna stick with normal linux implementation, as described here: > http://linux.die.net/man/1/echo
That's not Linux, that's GNU coreutils :) -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- A buscar no lo voy a ir -- Rata (Pichi Traful, febrero de 2011)
