Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by muyuu on Saturday February 21, 2015 @09:51PM
(#9088000)
Hehe I went in fully expecting GNU to have managed making something as simple as echo.c relatively complex and with inconceivable options. Was not disappointed. They probably even managed to include a GNUism or two.
[ Parent
| on HN ]
Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by caf on Sunday February 22, 2015 @05:55AM
(#9089020)
The GNU echo is designed to be useable on a variety of systems which had different traditional behaviours - this comment in the source code is instructive:
/* System V machines already have a /bin/sh with a v9 behavior.
Use the identical behavior for these machines so that the
existing system shell scripts won't barf. */
(BSD systems supported suppressing newline with -n; UNIX System V systems supported \ escape sequences; POSIX came later and allowed either unless the XSI option is supported).
Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by muyuu on Sunday February 22, 2015 @07:22AM
(#9089141)
Yep, including all that hydra-style-compatibility as part of the very base implementation of anything, is part of what makes GNU code the way it is.
I mean... in main() there's a labeled goto for "just_echo" - even that section alone has something like 6 or 7 indentation levels. If I was writing satire code of GNU style I'd probably wouldn't have gone so far. Hehehe.
Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by abusque on Sunday February 22, 2015 @12:55AM
(#9088426)
What do you mean by GNUism?
Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by muyuu on Sunday February 22, 2015 @01:26AM
(#9088493)
Non-POSIX options that may break compatibility at the user space (scripts, etc). Some people also include GCC stuff that is not standard compatible.
Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by pjmlp on Sunday February 22, 2015 @03:15AM
(#9088697)
Many young generations not touched by UNIX think way GNU tools behave == UNIX, when they usually offer more features than the real ones.
Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by masklinn on Sunday February 22, 2015 @08:10AM
(#9089253)
Then again, so do the BSD tools. And of course the options are often not compatible between the two e.g. bsd sed's -l enables line buffering, gnu sed's -l specifies line-wrapping length; bsd sed's -i requires an extension (empty for no backup) while gnu sed's does not.
POSIX sed supports exactly 3 options (-n, -e and -f), the latest FreeBSD sed supports 10 (adding -E, -a, -I, -i, -l, -r and -u — the last two being GNUism compatibility options not necessarily available on older versions, they are not on my OSX machine) and GNU sed supports 9 short and an additional 4 long options. And that's not counting the extensions to the sed command set.
Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by pjmlp on Sunday February 22, 2015 @10:35AM
(#9089703)
True, which is why it is hard to keep up with multiple UNIX implementations and to know what is supported on a given box without having to reach for man first.
Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU Coreutils Impl...
by masklinn on Monday February 23, 2015 @07:11AM
(#9093852)
I long for a straight POSIX-and-absolutely-nothing-else version of the core binaries, but haven't seen one so far.
Definitely less convenient, but would make building cross-platform scripts much easier.