A very basic blog about D

Leandro Lucarella luca at llucax.com.ar
Sun Jul 7 12:52:02 PDT 2013


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

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
All fathers are intimidating. They're intimidating because they are
fathers.  Once a man has children, for the rest of his life, his
attitude is, "To hell with the world, I can make my own people. I'll eat
whatever I want. I'll wear whatever I want, and I'll create whoever
I want."
	-- Jerry Seinfeld


More information about the Digitalmars-d-announce mailing list