News for hackers. Stuff that matters.
Re:Implementations of Cat(1) from Various Sources (2018) by alpb on Sunday January 19, 2020 @01:54AM (#22089882)
Unused variable in plan9 implementation? https://github.com/pete/cats/blob/master/plan9-cat.c#L22
Re:Implementations of Cat(1) from Various Sources (2018) by ygra on Sunday January 19, 2020 @02:08AM (#22089918)
Re:Implementations of Cat(1) from Various Sources (2018) by henesy on Sunday January 19, 2020 @02:32AM (#22089996)
Re:Implementations of Cat(1) from Various Sources (2018) by Someone on Sunday January 19, 2020 @11:09AM (#22092104)
Also used in the beautiful (for those who like being creative with the preprocessor) options parser https://9fans.github.io/plan9port/man/man3/arg.html
Re:Implementations of Cat(1) from Various Sources (2018) by g82918 on Sunday January 19, 2020 @03:24AM (#22090174)
Thank you, that bit was very interesting. I like the idea for single threaded applications of having argv0 be a global.
Re:Implementations of Cat(1) from Various Sources (2018) by sherincall on Sunday January 19, 2020 @07:04AM (#22090945)
Doesn't have to be single-threaded even. Main writes the pointer at the start, and no one else is going to change it, just read from it.
Re:Implementations of Cat(1) from Various Sources (2018) by im3w1l on Sunday January 19, 2020 @09:14AM (#22091513)
The plan9 one is short and sweet, but what I don't like is that it doesn't support the dashdash thing that unambiguously marks that rest of the arguments should be interpreted as files and not flags. Needed for reliable defensive shell scripts imo.

You may say "it has no options anyway" but other cats do. And you may want to add options in a future version.

Re:Implementations of Cat(1) from Various Sources (2018) by Someone on Sunday January 19, 2020 @11:15AM (#22092161)
I thought that’s a GNU-ism that wasn’t in POSIX, but https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1... taught me differently.

Now I think it made it into POSIX only fairly recently (corrections welcome)

(it is a good idea, though)