3 ms·
> Looks like Plan 9 and FreeBSD are the only ones to correctly handle write errors. Both only check for negative return codes. If stdout were piped/redirected
by asveikau 12y ago
> Looks like Plan 9 and FreeBSD are the only ones to correctly handle write errors.
Both only check for negative return codes. If stdout were piped/redirected to something where write(2) may return a short byte count (let's say a socket) neither of them will detect it.
> /* This utility may NOT do getopt(3) option parsing. */
I noticed this too. My guess, totally not backed up by anything but by instinct, is getopt(3) tried to do too much which doesn't make sense for echo. For example if it tried to parse "echo -foobar" as anything other than "you spit out the string '-foobar'" I could see it being problematic.
- johnny22 12y agoas mentioned above, it's a POSIX thing.